void pointerAccess(int *); void structAccess(int *); main() { int x, *p; printf("Enter value for x: "); scanf("%d", &x); p = &x; printf("Value of x = %d = %d = %d\n",x, *p, p[0]); printf("\nPointer Access..\n"); pointerAccess(&x); printf("\nStructure Access..\n"); structAccess(&x); } void pointerAccess(int *p) { int i; char *c; c = (char *) p; for(i=0; i < 4; i++) { printf("%x ", c[i]); } } void structAccess(int *p) { typedef struct { unsigned short int lowerHalf; unsigned short int upperHalf; } HalfandHalf; // Cast the pointer to p as a pointer to HalfandHalf HalfandHalf *t = (HalfandHalf *) p; printf("Lower half = %x\n", t->lowerHalf); printf("Upper half = %x\n", t->upperHalf); }