Govt Exams
Both {0} and {} will initialize all members to zero. These are equivalent in C99 and later standards.
struct u { int a; char b; }; u.a = 257; printf("%d", u.b);
In a union, both members share memory. 257 in binary is 100000001. u.b (char) reads only the LSB, which is 1.
C allows structures to have other structures as members. This is called nested structures and is a common practice.
char str[] = "GATE";
char *p = str;
printf("%c %c", *p, *(p+3));
p points to str[0] which is 'G'. p+3 points to str[3] which is 'E'. Wait - str="GATE" has indices 0:G, 1:A, 2:T, 3:E. So *(p+3) is 'E'. Correction: answer should be 'G E'. But checking: G-A-T-E at 0-1-2-3, so *(p+3)='E'. The option shows 'G T' - p points to G, p+2 would be T. Re-reading: *(p+3) for "GATE" is 'E'. None match exactly - assuming typo in original, output is G E, closest is option A if E shown as E not T.
const int *p: pointer can change, data cannot. int * const q: pointer cannot change, data can be modified.
Array name acts as pointer to first element in expressions but they're distinct. &arr and arr differ in type.
This allocates row pointers only. Each row needs allocation: arr[i] = (int*)malloc(m * sizeof(int));
%p prints pointer values. NULL representation depends on implementation, commonly shown as 0x0 or (nil).
Parentheses around *ptr give pointer priority. It's a pointer to a function taking 2 ints and returning int.
int arr[5];
arr decays to pointer to first element (int*). &arr is pointer to whole array (int(*)[5]). Pointer arithmetic differs.