Teaching UGC NET Mock Test Series 2025 (Paper 1 & 2) Programming and Data Structure Programming in C Pointer
Consider the following C-code fragment running on a 32-bit x86 machine:
typedef struct
{
union
{
unsigned char a;
unsigned short b;
}
unsigned char c;
}S;
S B[10];
S *p = &B[4];
S *q = &B[5];
p ā U.b = 0x1234;
/* structure S takes 32-bits */
If M is the value of q-p and N is the value of ((int) & (pā c))-((int)p), then (M, N) is
1
(1, 1)
2
(3, 2)
3
(1, 2)
4
(4, 4)