¶
~cpp
void Test(int * Ascores)
{
cout << "in function : ";
cout << sizeof(Ascores) << " " << sizeof(Ascores[0]) << endl;
}
void main()
{
int scores[4]={1,2,3,4};
cout<<"in main : ";
cout << sizeof(scores) << " " << sizeof(scores[0]) << endl;
Test(scores);
}
strlen int 길 구 .
간 sizeof(scores) 기 간 sizeof(scores) int* 기 .
기 ??
간 sizeof(scores) 기 간 sizeof(scores) int* 기 .
기 ??
.
길 ?? ;;
vs firend ??
길 ?? ;;
vs firend ??
경 ¶
겠 . 금 기 금 . 게 게 그 값 경 값 게 고. 그 값 거. 그 값 고 값 ? 그 그 . 구고 간게 .
~cpp
#include<iostream>
using namespace std;
void Test(int *aArray, int aLength)
{
int *copyArray = new int[aLength];// 과 기
for(int index = 0; index < aLength; index++)
copyArray[index] = aArray[index];//값
cout << "in function : ";
cout << sizeof(copyArray[0])*aLength << " " << sizeof(copyArray[0]) << endl;
//기 !
cout << "\n경 copyArray : ";//경 값 과
for(index = 0; index < aLength; index++)
cout << copyArray[index] << " ";
cout << endl;
for(index = 0; index < aLength; index++)//copyArray 값 0 기
copyArray[index] = 0;
cout << "경 copyArray : ";
for(index = 0; index < aLength; index++)
cout << copyArray[index] << " ";
cout << endl;
delete []copyArray;// !!!
}
void main()
{
int arrayLength;
int scores[4]={1,2,3,4};
cout<<"in main : ";
cout << sizeof(scores) << " " << sizeof(scores[0]) << endl;
arrayLength = sizeof(scores)/sizeof(scores[0]);
Test(scores, arrayLength);
//!!
cout << "\n 값 scores 값 .\nscores: ";
for(int index = 0; index < arrayLength; index++)
cout << scores[index] << " ";
cout << endl;
}










