NOTE: Output will vary for different size of int.
Assuming that integer requires 2 bytes
p = (char*)((int*)(p));
till now the pointer p is type casted to store the variable of type character right?
This is wrong, Type Casting donot change the Size of pointer.
means if it would have been p=((int*)p); instead of p = (char*)((int*)(p)); result would be same.
printf("%d, ", *p); // output : 2
integer array will be stored in memory MSB to LSB as
| 00000000 |
00000100 |
00000000 |
00000011 |
00000000 |
00000010 |
| 4 |
3 |
2 |
so p+2 points to that location 00000011.
printf("%d", *p); // output : 3
so answer is 2 3