| char a[] = { 65,66,67,68,69,0 };
char b[] = "ABCDE";
char c[10] = { 'A','B','C','D','E','\0' };
char d[][10] = {
{ 65,66,67,68,69,0 },
{ 70,71,72,73,74,0 },
{ 75,76,77,78,79,0 }
};
char e[][14] = {
"ABC",
"漢字",
"XYZ1234567890"
};
char *x = "文字列ポインタ変数の初期化";
char *y[] = {
"ABC",
"漢字",
"XYZ1234567890"
};
int main(int argc, char* argv[])
{
printf( "%s\n", a );
printf( "%s\n", b );
printf( "%s\n", c );
printf( "%x\n", c[6] );
printf( "\n" );
int i;
for( i = 0; i < 3; i++ ) {
printf( "%s\n", d[i] );
}
printf( "\n" );
for( i = 0; i < 3; i++ ) {
printf( "%s\n", e[i] );
}
printf( "\n" );
printf( "%s\n", x );
for( i = 0; i < 3; i++ ) {
printf( "%s\n", y[i] );
}
return 0;
}
| |