반응형
#include#include #include void bit_pointer_4_1() { char *imsip; char imsi; //imsip = 'a'; imsip = "a"; imsi = 'a'; //imsi = "a"; } void bit_pointer_4_2() { char *string; string ="archie"; printf("%c\n",*(string +0)); printf("%c\n",*(string +1)); printf("%c\n",*(string +2)); printf("%c\n",*(string +3)); printf("%c\n",*(string +4)); printf("%c\n",*(string +5)); } void bit_pointer_4_3() { char *string ="archie"; printf("%s\n",string[3]); } void bit_pointer_4_4() { char *string ="archie"; char dim[] ="dimention"; } void bit_pointer_4_5() { char *string ="archie"; char dim[] ="dimention"; printf("string %#010x\n",string); printf("&string %#010x\n",&string); printf("dim %#010x\n",dim); printf("&dim %#010x\n",&dim); printf("dim[0] %#010x\n",dim[0]); } //틀린 문제 void bit_pointer_4_6() { char *string ="archie"; char dim[] ="dimention"; for(;string;string++) putchar(*string); putchar('\n'); //for(;*dim;dim++) 오류 putchar(*dim); } void bit_pointer_4_7() { char *string ="archie"; char dim[] ="dimention"; int i; for(;string;string++) putchar(*string); putchar('\n'); for(i=0;dim[i];i++) putchar(*dim); } void bit_pointer_4_8() { char *string ="archie"; *string = 'T'; } void bit_pointer_4_9() { char string[] ="dimention"; string[0] = 'T'; puts(string); } void bit_pointer_4_10() { char name[5][20]; strcpy(name[0], "Jung Jae Une"); strcpy(name[1], "Han Woo Ryong"); strcpy(name[2], "Byun Ji Ha"); strcpy(name[3], "Lee Do Geun"); strcpy(name[4], "Hong Jae Mok"); } void bit_pointer_4_11() { char *name[5]; name[0]= "Jung Jae Une"; name[1]= "Han Woo Ryong"; name[2]= "Byun Ji Ha"; name[3]= "Lee Do Geun"; name[4]= "Hong Jae Mok"; } void bit_pointer_4_12() { char *name[5]; name[0]= "Jung Jae Une"; name[1]= "Han Woo Ryong"; name[2]= "Byun Ji Ha"; name[3]= "Lee Do Geun"; name[4]= "Hong Jae Mok"; puts(name[0]+5); puts(name[1]+4); puts(name[2]+5); puts(name[3]+4); puts(name[4]+5); } void bit_pointer_4_13() { char *name[5]; name[0] = (char *)malloc(sizeof(char)*strlen("archie") +1); strcpy(name[0],"archie"); puts(name[0]); } void bit_pointer_4_14() { char *name[5]; char imsi[7]; name[0] = imsi; strcpy(name[0],"archie"); puts(name[0]); } void bit_pointer_4_15() { int i,j; int dim_size; char *name[5]; name[0]= "Jung Jae Une"; name[1]= "Han Woo Ryong"; name[2]= "Byun Ji Ha"; name[3]= "Lee Do Geun"; name[4]= "Hong Jae Mok"; dim_size= sizeof(name)/4; for(i=0;i
'C, C++' 카테고리의 다른 글
[C] 도서관리(동적) (0) | 2014.11.18 |
---|---|
[C] 포인터 공부 5 (0) | 2014.11.18 |
[C] 포인터 공부 3 (0) | 2014.11.18 |
[C] 포인터 공부 2 (0) | 2014.11.18 |
[C] 포인터 공부 1 (0) | 2014.11.18 |