倩åœã«ãããèšèªå ¥éããããµæ§é äœ verïŒ.2130
ðððè€æ°ã®æååããŒã¿ãïŒã€ã®ãã€ã³ã¿å€æ°å®£èšã䜿ãåæã«ã¡ã¢ãªã«æ ŒçŽããŠã¿ãŸãããã®ïŒ
é åãçšããŠè€æ°ã®ãã€ã³ã¿å€æ°å®£èšãè¡ãããšãã§ããŸããé åãçšããŠè€æ°ã®ãã€ã³ã¿å€æ°å®£èšãè¡ããšã©ã®ãããªããšãå¯èœã«ãªãã®ã§ããããïŒ
ðððè€æ°ã®æååããŒã¿ãïŒã€ã®ãã€ã³ã¿å€æ°å®£èšã䜿ãåæã«ã¡ã¢ãªã«æ ŒçŽããŠã¿ãŸãããã®ïŒ
Visual Studio2019 ã§ã¯
ãã€ã³ã¿å€æ°ãçšããŠæååããŒã¿ãã¡ã¢ãªã«æ ŒçŽããæ©èœã¯åé€ãããŸãã
ãã®ãšããœãŒãã®
ãã€ã³ã¿å€æ°ãçšããŠæååããŒã¿ãã¡ã¢ãªã«æ ŒçŽããããã°ã©ã ã¯
å®è¡ã§ããŸãã
ã¢ã¬ãµãä»åã¯ã
ïŒã€ã®ãã€ã³ã¿å€æ°å®£èšã䜿ã£ãŠè€æ°ã®æååããŒã¿ãã¡ã¢ãªã«æ ŒçŽããŠã¿ãã
ãšããããŸãã
ïŒã€ã®é å宣èš
char str[]="apple";
char ars[]="ringo";
char arr[]="cashewnuts";
ã
ïŒã€ã®ãã€ã³ã¿å€æ°å®£èš
char* str="apple";
char* ars="ringo";
char* arr="cashewnuts";
ã
ã€ããããšã«ãã£ãŠãã³ã³ãã¥ãŒã¿ã®ã¡ã¢ãªã«åã蟌ãã§ããæ ŒçŽããŠãã
ã"apple"ã"ringo"ã"cashewnuts"ã®æååããŒã¿ã
ããããããããðãäžã€ã®ãã€ã³ã¿å€æ°å®£èšãð
ãããããðchar* hairetu[]={"apple","ringo","cashewnuts"}ð
ãããã¯[]å ã«èŠçŽ æ°ãæžã蟌ãã
ãããããðchar* hairetu[3]={"apple","ringo","cashewnuts"}ð
ãå®è¡ããããšã«ãã
ãŸãšããŠã¡ã¢ãªã«ãšãããããšãã§ãããšãããã®ãªã®ã§ããã
ð/
ãããããðchar* hairetu[]={"apple","ringo","cashewnuts"}ð
ãš
ãããããðchar* hairetu[3]={"apple","ringo","cashewnuts"}ð
ã¯
çããåœä»€æãšãªã£ãŠããŸã
ãããããðchar* hairetu[]={"apple","ringo","cashewnuts"}ð
ãšèšè¿°ãããš
{"apple","ringo","cashewnuts"}ã®ãªãã«èšè¿°ãããŠãã
3ã€ã®æååããŒã¿
"apple"
"ringo"
"cashewnuts"
ã®æ°3ã«åãããŠ
ãããããðchar* hairetu[]={"apple","ringo","cashewnuts"}ð
ãå®è¡ãããããšã«ãªããŸã
ð/
ãœãŒã©ãŒããšããããšã¯ã
ããããããšã
ç°ãªã3ã€ã®æååããŒã¿ãã³ã³ãã¥ãŒã¿ã®ã¡ã¢ãªã«ãšããããšã
é å宣èšãããã¯ãã€ã³ã¿å€æ°å®£èšãïŒã€ãããªããªããŠããããã ã
ã¢ã¬ãµãã¯ãã£ããããªãã§ãã®
ãã€ã³ã¿å€æ°ã¯ãšã£ãŠã䟿å©ãªãã§ããã
ã§ãã®ã§
ïŒã€ã®é å宣èšããããªã
char str[]="apple";
char ars[]="ringo";
char arr[]="cashewnuts";
æååããŒã¿
"apple"
"ringo"
"cashewnuts"
ãã
ã³ã³ãã¥ãŒã¿ã®ã¡ã¢ãªã«åã蟌ãã 次ã®ããã°ã©ã
ð
#include <stdio.h>
int main(void){
char str[]="apple";
char ars[]="ringo";
char arr[]="cashewnuts";
printf("%s\n",str);
printf("%s\n",ars);
printf("%s\n",arr);
return 0;
}
ã³ã³ãã€ã«çµæ
apple
ringo
cashewnuts
ã
ïŒã€ã®ãã€ã³ã¿å€æ°å®£èš
char* str="apple";
char* ars="ringo";
char* arr="cashewnuts";
ãè¡ã
æååããŒã¿
"apple"
"ringo"
"cashewnuts"
ã
ã³ã³ãã¥ãŒã¿ã®ã¡ã¢ãªã«åã蟌ãã 次ã®ããã°ã©ã
ð
include <stdio.h>
int main(void){
char* str="apple";
char* ars="ringo";
char* arr="cashewnuts";
printf("%s\n",str);
printf("%s\n",ars);
printf("%s\n",arr);
return 0;
}
ã³ã³ãã€ã«çµæ
apple
ringo
cashewnuts
ð
ãããã®ããã°ã©ã ã¯
ããããããããããããïŒã€ã®ãã€ã³ã¿å€æ°å®£èš
ããããããããchar* hairetu[]={"apple","ringo","cashewnuts"}
ãããã¯
ããããããããchar* hairetu[3]={"apple","ringo","cashewnuts"}
ã䜿ãããšã«ãã£ãŠ
ç°¡ç¥åãããŠ
次ã®ããã«ãããããããŸãã
#include <stdio.h>
int main(void){
char *hairetu[]={"apple","ringo","cashewnuts"};
printf("%s\n",hairetu[0]);
printf("%s\n",hairetu[1]);
printf("%s\n",hairetu[2]);
return 0;
}
ã³ã³ãã€ã«çµæ
apple
ringo
cashewnuts
ãœãŒã©ãŒãããã£ãã ãã¶ããã£ãããããã
ãšãããæååããŒã¿ã100åã ã£ãããã®æ¹æ³ã¯æå¹ã ã(^_^)/ã
ãœãŒã©ãŒããïœãŠãããã§è³ªåã§ïœãã
ã¢ã¬ãµããã®ãšã
printf("%s\n",hairetu[0]);
printf("%s\n",hairetu[1]);
printf("%s\n",hairetu[2]);
ãªã«ãè¡šèšæ³ãããããããšæãããŸããã
printf("%s\n",hairetu[0]);
printf("%s\n",hairetu[1]);
printf("%s\n",hairetu[2]);
ã®
hairetu[0]
hairetu[1]
hairetu[2]
ã«åœããéšåã«ã¯
ãã€ã³ã¿å€æ°ãä»£å ¥ãããªããã°ãªããŸããã
hairetu[0]
hairetu[1]
hairetu[2]
ã¯
é åå€æ°ã§
ãã€ã³ã¿å€æ°ã«èŠããªããããªæ°ãããŸãã
ãã€ã³ã¿å€æ°ãšãªã£ãŠããŸããã
ã¿ãªãïœã
ð¥ãð§ãðŠ. . .
ä»æ¥ã¯ã©ããªã話ãã§ãŠããã®ããªð
ð¥ãð§ãðŠ. . .
ããããã»ã»ã»
ããã§ã¯ã
ãœãŒã©ãŒãã
ç¶ããããããããŸããã
ãœãŒã©ãŒããµã€ã
printf("%s\n",hairetu);ã®
ããããããããããããð¥hairetuð¥ã¯
é åhairetuããã€ã³ã¿å€æ°hairetuãã€ãã£ãŠ
æååããŒã¿ãæ ŒçŽããããšã
ãã®æååããŒã¿ãæ ŒçŽãããŠããå é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹ã
æ ŒçŽããŠãããã€ã³ã¿å€æ°ã§ããã
åæã«
æååããŒã¿ãæ ŒçŽããŠããã¡ã¢ãªã代衚ããã¢ãã¬ã¹ã§ããããŸããã
âããâããâããâããâããâ
ã¡ãã£ãšã ãè£è¶³ããŸïœã
é åhairetuããã€ã³ã¿å€æ°hairetuãã€ãã£ãŠ
æååããŒã¿ãã¡ã¢ãªã«æ ŒçŽããããšã
é åå€æ°
hairetu[0]
hairetu[1]
hairetu[2]
ã»
ã»
ã»
ã«ã¯
æååããŒã¿ãæ ŒçŽãããããšã«ãªããŸãã
é åå€æ°
hairetu[0]
ã«ã¯
æååããŒã¿ã®å é ã®æåããŒã¿ãæ ŒçŽãããŠããŸã
ãããŠ
hairetuã¯
é åå€æ°
hairetu[0]
ã®ã¢ãã¬ã¹ãšãªã£ãŠããŸã
ããããããããããããããããsolarplexussãã
âããâããâããâããâããâ
ã§ãã®ã§
æååããŒã¿ã%såºåå€ææå®åããã¡ããŠ
printfåºå衚瀺ãããšãã«
printf("%s\n",hairetu);
ã®ããã«
ããããããããã€ã³ã¿å€æ°ð¥hairetuð¥ã¯ã
çšããããŸãã
åæ§ã«
ãã€ã³ã¿å€æ°å®£èš
char* hairetu[]={"apple","ringo","cashewnuts"};
ãè¡ãããŠ
æååããŒã¿
"apple"
"ringo"
"cashewnuts"
ãã¡ã¢ãªã«æ ŒçŽãããŠ
printf("%s\n",hairetu[0]);
printf("%s\n",hairetu[1]);
printf("%s\n",hairetu[2]);
ãå®è¡ããããšãã®
ãã®ãšãã®
ãããããããããããããããã
ããããããããããããð¥hairetu[0]ð¥ã¯
æååããŒã¿"apple"ãæ ŒçŽããŠããå é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹ãæ ŒçŽãããã€ã³ã¿å€æ°
ããããããããã
ããããããã
ããããããããããããð¥hairetu[1]ð¥ã¯
æååããŒã¿"ringo"ãæ ŒçŽããŠããå é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹ãæ ŒçŽãããã€ã³ã¿å€æ°
ããããããããããããããããã
ããããããããããããð¥hairetu[2]ð¥ã¯
æååããŒã¿"cashewnuts"ãæ ŒçŽããŠããå é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹ãæ ŒçŽãããã€ã³ã¿å€æ°
ãšãªã£ãŠããã®ã§ãã
ã€ãŸã
ãã€ã³ã¿å€æ°å®£èš
char* hairetu[]={"apple","ringo","cashewnuts"};
ãå®è¡ããããšã
ïŒã€ã®ãã€ã³ã¿å€æ°
hairetu[0]
hairetu[1]
hairetu[2]
ãçæãããŠããŸã
ãã®ãšã
ïŒã€ã®ãã€ã³ã¿å€æ°
hairetu[0]
hairetu[1]
hairetu[2]
ã䜿ã£ãŠ
æååããŒã¿ãã¡ã¢ãªã«æ ŒçŽãã
hairetu[0]="apple";
hairetu[1]="ringo";
hairetu[2]="cashewnuts";
ãå®è¡ãããããšã«çãããªããŸã
ïŒã€ã®ãã€ã³ã¿å€æ°
hairetu[0]
hairetu[1]
hairetu[2]
ã®å®è¡ã«ãããŠã¯
ïŒã€ã®ãã€ã³ã¿å€æ°
hairetu[0]
hairetu[1]
hairetu[2]
ã«
æååããŒã¿ãæ ŒçŽãããŠããããã«ã¿ããŸãã
æ£ç¢ºã«ã¯
ïŒã€ã®ãã€ã³ã¿å€æ°
hairetu[0]
hairetu[1]
hairetu[2]
ã«ã¯
æååããŒã¿
"apple"
"ringo"
"cashewnuts"
ãæ ŒçŽããŠããå é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹ãæ ŒçŽãããŠããŸã
char* hairetu[]={"apple","ringo","cashewnuts"};
ã¯
char* hairetu[3];
hairetu[0]="apple";
hairetu[1]="ringo";
hairetu[2]="cashewnuts";
ã
å®è¡ãããŠãããããªæããšãªããŸã
char* hairetu[3];
ãå®è¡ããããš
ïŒã€ã®ãã€ã³ã¿å€æ°
hairetu[0]
hairetu[1]
hairetu[2]
ãäœè£œãããŠãããããªåœ¢ã«ãªãã®ã§ããã
______________________________________
ãšããã§Visual Studio2018ã§ã¯
hairetu[0]ãšããååã®ãã€ã³ã¿å€æ°å®£èš
char* hairetu[0]="apple";
ã¯ãã«ãã§ããŸããã
Visual Studioã®ã³ã³ãã€ã©ã¯hairetu[0]ãïŒã€ã®ãã€ã³ã¿å€æ°åãšã¿ãªããŠããŸããã
Visual Studioã®ã³ã³ãã€ã©ã¯
char* hairetu[0]ã¯
ãã€ã³ã¿å€æ°ã®é åãã€ãããã®ãšåãåã£ãŠããŸããŸãã
ã€ãŸãèŠçŽ æ°ã
char* hairetu[3];ã®ããã«
3ãªã
hairetu[0]
hairetu[1]
hairetu[2]
ã®ããã«
ãã€ã³ã¿å€æ°ã®é å
hairetu[0]
hairetu[1]
hairetu[2]
ãäœè£œãããããšã«ãªããŸãã
èŠçŽ æ°ã0ãšèšè¿°ããŠããã®ã§
ãã€ã³ã¿å€æ°ã®é åã1ã€ãäœè£œã§ããŸãããš
ãã«ããšã©ãŒã衚瀺ãããŸã
______________________________________
次ã®ããã°ã©ã ã®ã³ã³ãã€ã«çµæãã¿ãŠããã ããã°
hairetu[0]
hairetu[1]
hairetu[2]
ã
æååããŒã¿
"apple"
"ringo"
âcashewnutsâ
ã
æ ŒçŽããŠããå é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹ãæ ŒçŽããŠãã
ãã€ã³ã¿å€æ°ãšãªã£ãŠããããšã
ããããã«ãªããããšæããŸãã
ã€ãã§ã«
ãã€ã³ã¿å€æ°
hairetu[0]
hairetu[1]
hairetu[2]
ãæ ŒçŽããŠããã¢ãã¬ã¹ã
次ã®ããã°ã©ã ã§è¡šç€ºããŠã¿ãããšæããŸãã
#include <stdio.h>
int main(void){
char* hairetu[]={"apple","ringo","cashewnuts"};
printf("%s\n",hairetu[0]);
printf("%s\n",hairetu[1]);
printf("%s\n",hairetu[2]);
printf("%p\n",hairetu[0]);
printf("%p\n",hairetu[1]);
printf("%p\n",hairetu[2]);
return 0;
}
ã³ã³ãã€ã«çµæ
EAZY IDECã®å Žå
apple
ringo
cashewnuts
00402000
00402006
0040200C
Visual Studioã®å Žå
apple
ringo
cashewnuts
001C7CE0
001C7BD8
001C7B30
ãœãŒã©ãŒã
printf("%s\n",hairetu[0]);
printf("%s\n",hairetu[1]);
printf("%s\n",hairetu[2]);
ãå®è¡ãããããšã«ãã
æåå
apple
ringo
cashewnuts
ã
ã³ãã³ãããã³ããç»é¢ã«è¡šç€ºããããã
ã€ãŸã
hairetu[0]
hairetu[1]
hairetu[2]
ã¯
æååããŒã¿
"apple"
"ringo"
âcashewnutsâ
ã
æ ŒçŽããŠããå é ã®ã¡ã¢ãªã®
ã¢ãã¬ã¹ãæ ŒçŽããŠãã
ãã€ã³ã¿å€æ°ãšãªã£ãŠããããšãããããŸããã
ãã€ã³ã¿å€æ°
hairetu[0]
hairetu[1]
hairetu[2]
ã®æ ŒçŽããŠããã¢ãã¬ã¹ã
printf("%p\n",hairetu[0]);
printf("%p\n",hairetu[1]);
printf("%p\n",hairetu[2]);
ãè¡ãããããšã«ãã
EAZY IDECã®å Žå
ã³ã³ãã€ã«çµæ
00402000
00402006
0040200C
Visual Studioã®å Žå
ãã«ãå®è¡çµæ
001C7CE0
001C7BD8
001C7B30
ãšã³ãã³ãããã³ããç»é¢ã«è¡šç€ºãããŠããã®ããããã®ã§ãã
ãã®ã³ã³ãã€ã«çµæã¯
å ã®
ðïŒã€ã®ãã€ã³ã¿å€æ°ð
str
ars
arr
ãã€ãã£ãŠ
æååããŒã¿"apple"
æååããŒã¿"ringo"
æååããŒã¿"cashewnuts"
ãã¡ã¢ãªã«æ ŒçŽããŠ
printf("%p\n",str);
printf("%p\n",ars);
printf("%p\n",arr);
ãå®è¡ãããšãã®
ã³ã³ãã€ã«çµæãšäžèŽããŠããŸãã
ããã°ã©ã ã¯
以äžã®ããã§ãããã
#include <stdio.h>
int main(void){
char* str="apple";
char* ars="ringo";
char* arr="cashewnuts";
printf("%p\n",str);
printf("%p\n",ars);
printf("%p\n",arr);
return 0;
}
ã³ã³ãã€ã«çµæ
EAZY IDECã®å Žå
00402000
00402006
0040200c
Visual Studioã®å Žå
001C7CE0
001C7BD8
001C7B30
ããã¯ãããŠãããŠ
ãµã ãã¯
1ã€ã®æååããŒã¿ãã¡ã¢ãªã«æ ŒçŽãããšã
char hairetu[]ãchar* hairetuã«ãã£ãŠçæããã
hairetu[0]
hairetu[1]
hairetu[2]
ã¯
æåããŒã¿ãæ ŒçŽã§ããé åå€æ°
ãšãªããã ãã©
ä»ã®å Žåã®ããã«
ãã€ã³ã¿å€æ°ã®é å宣èšïŒã€ãŸããã€ã³ã¿å€æ°ãå€æ°äœè£œããããšããããšïŒ
char* hairetu[]={"apple","ringo","cashewnuts"};
ãå®è¡ãããå Žå
ã¢ãã¬ã¹ãæ ŒçŽãããã€ã³ã¿å€æ°
hairetu[0]
hairetu[1]
hairetu[2]
ãçæãããããšã«ãªããŸã
hairetu[0]
hairetu[1]
hairetu[2]
ã¯
æåããŒã¿ãæ ŒçŽããé åå€æ°ã§ãªã
æååããŒã¿
"apple"
"ringo"
"cashewnuts"
ãä¿åããŠããå é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹ãæ ŒçŽããŠãã
ãã€ã³ã¿å€æ°ãšãªã£ãŠãããã ãã
ã¢ã¬ãµãã€ãŸã
char* hairetu[]={"apple","ringo","cashewnuts"};
ããªãã¡
char* hairetu[3]={"apple","ringo","cashewnuts"};
ã§ã¯
ïŒã€ã®ãã€ã³ã¿å€æ°å®£èšã«ãã
ïŒã€ã®ãã€ã³ã¿å€æ°
hairetu[0]
hairetu[1]
hairetu[2]
ãçæãããŠããã®ã§ããã
{"apple","ringo","cashewnuts"}å ã®æååããŒã¿
ã®æ°ã3ã€ãªã®ã«åãããŠ
char* hairetu[]={"apple","ringo","cashewnuts"};
ãå®è¡ããããš
char* hairetu[3]={"apple","ringo","cashewnuts"};
ãå®è¡ãã
ãã€ã³ã¿å€æ°
hairetu[0]
hairetu[1]
hairetu[2]
ãäœè£œãããŠããŸãã
ãœãŒã©ãŒããããŠ
ïŒã€ã®é å宣èš
char str[]="apple";
char ars[]="ringo";
char arr[]="cashewnuts";
ïŒã€ã®ãã€ã³ã¿å€æ°å®£èš
char* str="apple";
char* ars="ringo";
char* arr="cashewnuts";
äžçªç°¡åã«èšè¿°ã§ãã
char* hairetu[]={"apple","ringo","cashewnuts"};
ã«ãããŠ
"apple","ringo","cashewnuts"ãæ ŒçŽãããŠãã
å é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹ã
ãããã
EAZY IDECã®å Žå
ïŒã€ã®é å宣èšãçšãã
char str[]="apple";
char ars[]="ringo";
char arr[]="cashewnuts";
ãå®è¡ããå Žåã¯
"apple","ringo","cashewnuts"ãæ ŒçŽããã
å é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹ã
0019FF52(æååããŒã¿"apple"ãæ ŒçŽããŠããå é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹)
0019FF4C(æååããŒã¿"ringo"ãæ ŒçŽããŠããå é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹)
0019FF41(æååããŒã¿"cashewnuts"ãæ ŒçŽããŠããå é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹)
ãšãªã£ãŠããŠ
ïŒã€ã®ãã€ã³ã¿å€æ°å®£èšãçšãã
char* str="apple";
char* ars="ringo";
char* arr="cashewnuts";
ãå®è¡ããå Žåã¯
æååããŒã¿
"apple","ringo","cashewnuts"ãæ ŒçŽããã
å é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹ã
00402000(æååããŒã¿"apple"ãæ ŒçŽããŠããå é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹)
00402006(æååããŒã¿"ringo"ãæ ŒçŽããŠããå é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹)
0040200C(æååããŒã¿"cashewnuts"ãæ ŒçŽããŠããå é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹)
ãšãªã£ãŠããŠ
äžçªç°¡åã«èšè¿°ã§ãã
char* hairetu[]={"apple","ringo","cashewnuts"};
ãå®è¡ããå Žåã¯
æååããŒã¿
"apple","ringo","cashewnuts"ãæ ŒçŽããã
å é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹ã
00402000(æååããŒã¿"apple"ãæ ŒçŽããŠããå é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹)
00402006(æååããŒã¿"ringo"ãæ ŒçŽããŠããå é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹)
0040200C(æååããŒã¿"cashewnuts"ãæ ŒçŽããŠããå é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹)
ãšãªã£ãŠããŠ
Visual Studioã®å Žå
ïŒã€ã®é å宣èš
char str[]="apple";
char ars[]="ringo";
char arr[]="cashewnuts";
ãå®è¡ããå Žåã¯
æååããŒã¿
"apple","ringo","cashewnuts"ãæ ŒçŽããã
å é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹ã
0053FE14
0053FE04
0053FEF0
ãšãªã£ãŠããŠ
ïŒã€ã®ãã€ã³ã¿å€æ°å®£èš
char* str="apple";
char* ars="ringo";
char* arr="cashewnuts";
ãå®è¡ããå Žåã¯
æååããŒã¿
"apple","ringo","cashewnuts"ãæ ŒçŽããã
å é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹ã
001C7CE0
001C7BD8
001C7B30
ãšãªã£ãŠããŠ
äžçªç°¡åã«èšè¿°ã§ãã
char* hairetu[]={"apple","ringo","cashewnuts"};
ãå®è¡ããå Žåã¯
æååããŒã¿
"apple","ringo","cashewnuts"ãæ ŒçŽããã
å é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹ã
001C7CE0
001C7BD8
001C7B30
ãšãªã£ãŠãããšããã
ãšã£ãŠããè¶ç®ããã ããã
ã¢ã¬ãµãããã¯ããããããšæããŸãã®
EAZY IDECã®å Žåã§ã¯
ïŒã€ã®é å宣èšãçšãã
char str[]="apple";
char ars[]="ringo";
char arr[]="cashewnuts";
ãå®è¡ããå Žåã¯
"apple","ringo","cashewnuts"ãæ ŒçŽããã
å é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹ã
0019FF52
0019FF4C
0019FF41
ãšãªã£ãŠããã®ãããããŸã
ãã®ãšã
æååããŒã¿ã
æ ŒçŽããé åºã
æ°å€ã®å€§ãã
ã¢ãã¬ã¹0019FF52ãã
æ°å€ã®å°ãã
ã¢ãã¬ã¹0019FF41ãšãªã£ãŠããŸã
char* hairetu[]={"apple","ringo","cashewnuts"};
ãå®è¡ããå Žåã¯
æååããŒã¿
"apple","ringo","cashewnuts"ãæ ŒçŽããã
å é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹ã¯
00402000
00402006
0040200C
ãšãªã£ãŠããŸã
ãã¡ãã§ã¯
æååããŒã¿ã
æ ŒçŽããé åºã
æ°å€ã®å°ããã¢ãã¬ã¹00402000ãããšãªã£ãŠããŸãã
ãããŠããã¿ããš
00402000ã®æ¬¡ã®ã¢ãã¬ã¹ã
00402006ã«ãªã£ãŠããŸã
ãã㯠æååããŒã¿"apple"
ãã¡ã¢ãªã«æ ŒçŽãããé
appleïŒïŒãã€ãïŒãš
appleãã³ã³ãã¥ãŒã¿ã«æååãšèªèãããããã®
ãã«æå\0ïŒïŒãã€ãïŒãã¡ã¢ãªã«æ ŒçŽãããã
"apple"ã®æ¬¡ã«æ ŒçŽãããæååããŒã¿ã§ãã
"ringo"ãæ ŒçŽããå Žæã®ã¢ãã¬ã¹ã
00402000ãã6ãã€ãåŸã®
00402006ããå§ãŸã£ãŠãããããªã®ã§ã
ãããŠæ¬¡ã¯
æååããŒã¿"ringo"
ãã¡ã¢ãªã«æ ŒçŽãããããšã«ãªãã®ã§ãã
æååringoïŒïŒãã€ãïŒãš
æååringoãã³ã³ãã¥ãŒã¿ã«æååãšèªèãããããã®
ãã«æå\0ïŒïŒãã€ãïŒãã¡ã¢ãªã«æ ŒçŽããããšã«ãªãã®ã§
"ringo"ã®æ¬¡ã«æ ŒçŽãããæååããŒã¿ã§ãã
"cashewnuts"ãæ ŒçŽããã¡ã¢ãªã®ã¢ãã¬ã¹ã¯
00402006ããïŒãã€ãåŸã®
0040200Cããå§ãŸã£ãŠããã®ã§ãã
ãããã§ããïŒã
ãœãŒã©ãŒãããããããã
Niceããã©ãïœãã¢ã¬ãµïœ
ãããð
ãã¯ã¯ã¯ã¯
ãã£ãšãã£ãšããã£ãã®ç¶ãã ã£ãã
ïŒã€ã®é å宣èš
char str[]="apple";
char ars[]="ringo";
char arr[]="cashewnuts";
ïŒã€ã®ãã€ã³ã¿å€æ°å®£èš
char* str="apple";
char* ars="ringo";
char* arr="cashewnuts";
äžçªç°¡åã«èšè¿°ã§ãã
char* hairetu[]={"apple","ringo","cashewnuts"};
ã¯æååããŒã¿
"apple","ringo","cashewnuts"ãã¡ã¢ãªã«æ ŒçŽããŠããã
ãããŠ
char* str="apple";
char* ars="ringo";
char* arr="cashewnuts";
ã䜿ã£ãŠ
æååããŒã¿
"apple"
"ringo"
"cashewnuts"
ãã³ã³ãã¥ãŒã¿ã®ã¡ã¢ãªã«æ ŒçŽããå Žå
ãš
char* hairetu[]={"apple","ringo","cashewnuts"};
ã䜿ã£ãŠ
æååããŒã¿
"apple"
"ringo"
"cashewnuts"
ãã³ã³ãã¥ãŒã¿ã®ã¡ã¢ãªã«æ ŒçŽããå Žåã®
printf("%p\n",hairetu[0]);
printf("%p\n",hairetu[1]);
printf("%p\n",hairetu[2]);
ã®
ã³ã³ãã€ã«çµæã
ã ðäž¡æ¹ãšãçããð
EAZY IDECã®å Žå
00402000
00402006
0040200C
Visual Studioã®å Žå
001C7CE0
001C7BD8
001C7B30
ãš
ãªã£ãŠããŸã
ãã®ããã«
char* str="apple";
char* ars="ringo";
char* arr="cashewnuts";
ãš
char* hairetu[]={"apple","ringo","cashewnuts"};
ãå®è¡ãããšã
æååããŒã¿
"apple"
"ringo"
"cashewnuts"
ãæ ŒçŽããå é ã®ã¡ã¢ãªã®ã¢ãã¬ã¹ãäžèŽããŠãã
ãšããããšã¯
ïŒã€ã®ãã€ã³ã¿å€æ°å®£èš
char* str="apple";
char* ars="ringo";
char* arr="cashewnuts";
ãã€ãã£ãŠ
æååããŒã¿
"apple"
"ringo"
"cashewnuts"
ãã¡ã¢ãªã«æ ŒçŽããå Žåãš
äžçªç°¡åã«èšè¿°ã§ãã
char* hairetu[]={"apple","ringo","cashewnuts"};
ãã€ãã£ãŠ
æååããŒã¿
"apple"
"ringo"
"cashewnuts"
ãã¡ã¢ãªã«æ ŒçŽããå Žåã§ã¯èšè¿°æ¹æ³ãéãããã©ã
å šãåãåœä»€ãã³ã³ãã¥ãŒã¿ã«äžããŠããããšã«ãªããã
ãã
ïŒã€ã®é å宣èš
char str[]="apple";
char ars[]="ringo";
char arr[]="cashewnuts";
ã䜿ã£ãŠ
æååããŒã¿
"apple"
"ringo"
"cashewnuts"
ãã³ã³ãã¥ãŒã¿ã®ã¡ã¢ãªã«æ ŒçŽããå Žåã¯
æååããŒã¿
"apple"
"ringo"
"cashewnuts"ã
æ ŒçŽããã¡ã¢ãªã®ã¢ãã¬ã¹ã¯
EAZY IDECã®å Žå
0019FF52
0019FF4C
0019FF41
Visual Studioã®å Žå
0053FE14
0053FE04
0053FEF0
ãš
ãã€ã³ã¿å€æ°ã䜿ã£ãŠ
æååããŒã¿
"apple","ringo","cashewnuts"ãã¡ã¢ãªã«æ ŒçŽããå Žåãš
ç°ãªã£ãŠãããã
ãã€ã³ã¿å€æ°ã䜿ã£ãŠ
æååããŒã¿
"apple","ringo","cashewnuts"ãã¡ã¢ãªã«æ ŒçŽããå Žåãš
é åã䜿ã£ãŠæååããŒã¿
"apple","ringo","cashewnuts"ãã¡ã¢ãªã«æ ŒçŽããå Žåã§ã¯
ç°ãªã£ãåœä»€ãã³ã³ãã¥ãŒã¿ã«éãããŠãããã ããã
æ°èŠç»é²ã§å å®ã®èªæžã
- ãã€ããŒãž
- èªæžã®ç¶æ³ããäœåãèªåã§åé¡ããŠç°¡åã«ç®¡çã§ãã
- å°èª¬ã®æªèªè©±æ°ãã²ãšç®ã§ãããååã®ç¶ãããèªãã
- ãã©ããŒãããŠãŒã¶ãŒã®æŽ»åãè¿œãã
- éç¥
- å°èª¬ã®æŽæ°ãäœè ã®æ°äœã®æ å ±ãåãåãã
- é²èŠ§å±¥æŽ
- 以åèªãã å°èª¬ãäžèŠ§ã§èŠã€ãããã
ã¢ã«ãŠã³ãããæã¡ã®æ¹ã¯ãã°ã€ã³
ãã¥ãŒã¯ãŒèšå®
æåãµã€ãº
èæ¯è²
ãã©ã³ã
çµã¿æ¹å
æ©èœããªã³ã«ãããšãç»é¢ã®äžéšãã¿ãããã床ã«èªåçã«ã¹ã¯ããŒã«ããŠèªã¿é²ããããŸãã
å¿æŽãããšå¿æŽã³ã¡ã³ããæžããŸã