#include <stdio.h>
struct bar
{
int data[9];
};
#if 0
http://stackoverflow.com/questions/42916249/typecasting-to-constant-literal-why-this-output-of-a-c-program
((struct bar*)1)
This is same as treating that value as a pointer to struct bar *.
For example:
int *p = 1
((struct bar*)p)
This is same as above.
#endif
int main(void) {
printf("%d \n", ((struct bar
*)1) + 1); printf("%d \n", ((struct bar
*)-1) + 1); //printf("%d", ((struct bar*)1) + 1);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgpzdHJ1Y3QgYmFyCnsKICAgIGludCBkYXRhWzldOwp9OwogCiAKI2lmIDAKaHR0cDovL3N0YWNrb3ZlcmZsb3cuY29tL3F1ZXN0aW9ucy80MjkxNjI0OS90eXBlY2FzdGluZy10by1jb25zdGFudC1saXRlcmFsLXdoeS10aGlzLW91dHB1dC1vZi1hLWMtcHJvZ3JhbQoKKChzdHJ1Y3QgYmFyKikxKQoKVGhpcyBpcyBzYW1lIGFzIHRyZWF0aW5nIHRoYXQgdmFsdWUgYXMgYSBwb2ludGVyIHRvIHN0cnVjdCBiYXIgKi4KRm9yIGV4YW1wbGU6CmludCAqcCA9IDEKKChzdHJ1Y3QgYmFyKilwKQoKVGhpcyBpcyBzYW1lIGFzIGFib3ZlLgoKI2VuZGlmCgppbnQgbWFpbih2b2lkKSB7CiAgICBwcmludGYoIiVkIFxuIiwgKChzdHJ1Y3QgYmFyKikxKSArIDEpOwogICAgcHJpbnRmKCIlZCBcbiIsICgoc3RydWN0IGJhciopLTEpICsgMSk7CiAgICAvL3ByaW50ZigiJWQiLCAoKHN0cnVjdCBiYXIqKTEpICsgMSk7CglyZXR1cm4gMDsKfQo=