+ 2
C pointer and Typecasting (need help)
Hi, i got this code from my CS coding professor. Can somebody explain it to me please. #include <stdio.h> int main() { unsigned int i = 3224374275u; printf("%d\n", *(unsigned char*)&i); // 3 printf("%d\n", *((unsigned char*)&i+1)); // 12 printf("%d\n", *((unsigned char*)&i+2)); // 48 printf("%d\n", *((unsigned char*)&i+3)); // 192 printf("%d\n", *(unsigned short*)&i); // 3075 printf("%d\n", *((unsigned short*)&i+1)); // 49200 }
1 Answer
+ 4
Thank you so much, both of you. I see, still a lot to learn :)