'포인터배열'에 해당되는 글 1건

  1. 2009.03.24 다중포인터II, 포인터배열, 배열포인터
C/C++2009. 3. 24. 20:51

/*
#include <stdio.h>   //문자열 중에 일치되는 첫문자 찾기

int main(){

char Select;
char Sel[]= "None but The Brave deserves the Fair";
char *tmp;


printf("문자열 : %s\n",Sel);
printf("찾을 문자 입력 : ");
scanf("%c",&Select);
for(tmp=Sel;*tmp!=NULL;tmp++){
if(*tmp==Select)break;
}
printf("일치되는 첫번째 문자열은 %d입니다 \n",tmp-Sel+1);
}
*/

/*
#include <stdio.h>
int main(){

char *name1[4] = { "apple","Orange","Banana","Grape"};
char name2[4][10] = { "apple","Orange","Banana","Grape"};
int i;

for(i=0;i<4;i++){  //2차원 배열
printf("name2[%d] = %8s (%d) \n",i,name2[i],name2[i]);//12로 시작 스텍영역
}
printf("============================\n");

for(i=0;i<4;i++){  //포인터 배열
printf("name1[%d] = %8s (%d) \n",i,name1[i],name1[i]);//4로 시작 데이터영역
}
return 0;
}
*/

/*
#include <stdio.h>

int main(){

int A[5] = {10,20,30,40,50};
int *p = A;
int i;
int AA[3][4] = {
{1,2,3,4},
{5,6,7,8},
{9,10,11,12}
};
int (**pp)[4];  //**pp 두번으로 커널영역 접근하여 에러발생

for(i=0;i<5;i++){
printf("%d\n",p[i]);
}

pp = AA;

printf("pp = %d \n",pp);
printf("AA = %d \n",AA);

printf("*pp = %d \n",*pp);
printf("*AA = %d \n",*AA);

printf("**pp = %d \n",**pp);
printf("**AA = %d \n",**AA);

printf("AA[1][2] = %d \n",AA[0][1]);
printf("pp[1][2] = %d \n",pp[0][1]);
return 0;

}
*/


/*
#include <stdio.h>
int main(){

 char c;
 printf("getchr : ");
 c = getchar ();
 printf("입력한 값 : %c\n",c);
 //fflush(stdin);
 printf("fgetc : ");
 c = fgetc(stdin);
 printf("입력한 값 : %c\n",c);
 return 0;
}
*/

 

Posted by 샤키