2006.09.14 Thursday | 01:18

  メモリを文字列配列として使う ふるいむかし

漢字
表示
テスト
0012FF20
0012FF20
0012FF25
0012FF25
0012FF2A
0012FF2A


int main(int argc, char* argv[])
{
	char buff[80];

	char **a;

	a = (char **)buff;

	char buff2[80] = "漢字\0表示\0テスト";

	a[0] = buff2+0;
	a[1] = buff2+5;
	a[2] = buff2+10;

	printf( "%s\n", a[0]);
	printf( "%s\n", a[1]);
	printf( "%s\n", a[2]);

	printf( "%08X\n", a[0] );
	printf( "%08X\n", ((int *)buff)[0] );

	printf( "%08X\n", a[1] );
	printf( "%08X\n", ((int *)buff)[1] );

	printf( "%08X\n", a[2] );
	printf( "%08X\n", ((int *)buff)[2] );

	return 0;
}