Quick C pointers review:
Note to students: feel free to download the code from here:
unsigned char* x = (unsigned char*)0x8; unsigned int* y = (unsigned int*)0x8; printf("x = %p\n", x); // will print "0x8" printf("x + 1 = %p\n", x + 1); // will print "0x9" printf("y + 1 = %p\n", y + 1); // will print "0xC", why? printf("*x = %d\n", *x); // will print 32 printf("x[0] = %d\n", x[0]); // will print 32 printf("x[1] = %d\n", x[1]); // will print 48 printf("y[0] = %u\n", y[0]); // will print a big number. Why??? printf("*x = %d\n", *x); // will print 32 printf("x[0] = %d\n", x[0]); // will print 32 printf("x[1] = %d\n", x[1]); // will print 48 printf("y[0] = %u\n", y[0]); // will print a big number. Why??? // (Hint: you may want to read how // integers are stored in an // "Little Endian" computer)
Quick C pointers review:
Note to students: feel free to download the code from here: