{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

06장_배열과%20포인터

# Cpp 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ; *(p+2); cout << "\t a[2]=>" << a[2] << "\n"; } - 22 - IT COOKBOOK [실습하기 6-13] 배열의 원소를 출력하는 함수 사용하기 [예제 6-13] 6_13.cpp 01 02 03 04 05 06 07 08 09 10 11 12 13 14 #include<iostream> using namespace std; void prn(int *pa,int size); void main() { int a[5] = {10,20,30,40,50}; prn(a, 5); } void prn(int *pa, int size) { for(int i = 0;i<size;i++) cout<<" "<<*(pa+i); //pa[i]; cout<<"\n"; } - 23 - IT COOKBOOK [실습하기 6-14] 포인터 변수를 배열로 표현하기 IT COOKBOOK [예제 6-14] 6_14.cpp 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 #include<iostream> using namespace std; void prn(int a,int size); void main() { int a[5] = {10,20,30,40,50}; prn(a, 5); cout << " main 함수 : sizeof(a)==> "<< sizeof(a) << endl; } void prn(int a, int size) { for(int i = 0;i<size;i++) cout<<" "<<a[i]; cout<<"\n"; cout << " prn 함수 : sizeof(a)==> "<< sizeof(a) << endl; } - 24 - 4) 2차원 포인터 IT COOKBOOK - 25 - [실습하기 6-15] 2차원 포인터 사용하기 [예제 6-15] 6_15.cpp 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 #include<iostream> using namespace std; void main() { int a=5; int *p; int **pp; p=&a; pp=&p; cout<<" cout<<" cout<<" cout<<" cout<<" p =>"<< p <<" &a=>"<< &a << endl; *p =>"<< *p <<" a =>"<< a << endl; pp =>"<< pp <<" &p...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online