문 ¶
~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;
}










