#include <stdio.h>
int main(int argc, char* argv[])
{
char *a ="12345";
char s[] ="12345";
char S[10];
/* S = "12345" Sは配列の先頭要素のアドレスを指すだけなので代入できない*/
S[0] = '1';
S[1] = '2';
S[2] = '3';
S[3] = '4';
S[4] = '5';
S[5] = '\0';
printf("%p :%c\n",&a
[0],a
[0]); printf("%p :%c\n",&a
[1],a
[1]); printf("%p :%c\n",&a
[2],a
[2]); printf("%p :%c\n",&a
[3],a
[3]); printf("%p :%c\n",&a
[4],a
[4]);
printf("%p :%c\n",&s
[0],s
[0]); printf("%p :%c\n",&s
[1],s
[1]); printf("%p :%c\n",&s
[2],s
[2]); printf("%p :%c\n",&s
[3],s
[3]); printf("%p :%c\n",&s
[4],s
[4]);
printf("%p :%c\n",&S
[0],S
[0]);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbihpbnQgYXJnYywgY2hhciogYXJndltdKQp7CiAgY2hhciAqYSAgICA9IjEyMzQ1IjsKICBjaGFyIHNbXSA9IjEyMzQ1IjsKICBjaGFyIFNbMTBdOwovKiAgUyA9ICIxMjM0NSIgIFPjga/phY3liJfjga7lhYjpoK3opoHntKDjga7jgqLjg4njg6zjgrnjgpLmjIfjgZnjgaDjgZHjgarjga7jgafku6PlhaXjgafjgY3jgarjgYQqLwogIFNbMF0gPSAnMSc7CiAgU1sxXSA9ICcyJzsKICBTWzJdID0gJzMnOwogIFNbM10gPSAnNCc7CiAgU1s0XSA9ICc1JzsKICBTWzVdID0gJ1wwJzsKCiAgcHJpbnRmKCIlcFxuIixhKTsKICBwcmludGYoIiVwXG4iLHMpOwoKICBwcmludGYoIiVwIDolY1xuIiwmYVswXSxhWzBdKTsKICBwcmludGYoIiVwIDolY1xuIiwmYVsxXSxhWzFdKTsKICBwcmludGYoIiVwIDolY1xuIiwmYVsyXSxhWzJdKTsKICBwcmludGYoIiVwIDolY1xuIiwmYVszXSxhWzNdKTsKICBwcmludGYoIiVwIDolY1xuIiwmYVs0XSxhWzRd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