GATE 2017 CS (CS2) – Question 12
Match (P) static char var; (Q) m = malloc(10); m = NULL; (R) char *ptr[10]; (S) register int var1; with (i) sequence of memory locations storing addresses, (ii) variable in data section, (iii) request for a CPU register, (iv) lost memory that cannot be freed.
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (A) P–ii,Q–iv,R–i,S–iii
Explanation
Static storage belongs to the data area, P–ii. Replacing the only pointer to allocated memory by NULL loses that allocation, Q–iv. An array of ten pointers stores ten addresses, R–i. The register storage-class keyword requests register allocation, S–iii. Thus A; the register request need not be honoured.