Skip to content

Instantly share code, notes, and snippets.

@macrat
Created June 18, 2015 06:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save macrat/0bcb58ba02d9eb24a445 to your computer and use it in GitHub Desktop.
Save macrat/0bcb58ba02d9eb24a445 to your computer and use it in GitHub Desktop.
C言語なんか真面目に触っちゃいけないぞ。というお話をしていた。
#include <stdio.h>
struct stTAMA_CHARS {
char t;
char a;
char m;
char A;
};
struct stTAMA_INT {
int tama;
};
int main()
{
char* isono[] = {"tama.mother", "tama.father", "tama.next", "tama.father.father"};
struct stTAMA_CHARS tamachar = {1, 2, 3, 4};
struct stTAMA_INT* tamaint = (struct stTAMA_INT*)&tamachar;
printf("%s\n", isono[1]);
printf("%s\n", 1[isono]);
printf("%s\n", &((1[isono])[5]));
printf("%s\n", (isono+1)[1]);
printf("%s\n", &5[1[&(1[isono+1])]]);
printf("%s\n", &(0[&isono[3][5]]));
printf("\n");
printf("%02x %02x %02x %02x\n", tamachar.t, tamachar.a, tamachar.m, tamachar.A);
printf("%x\n", tamaint->tama);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment