Open In App

GATE | GATE-CS-2000 | Question 12

Like Article
Like
Save
Share
Report

The most appropriate matching for the following pairs

X: m=malloc(5); m= NULL;        1: using dangling pointers
Y: free(n); n->value=5;         2: using uninitialized pointers
Z: char *p; *p = ’a’;           3. lost memory is: 

(A) X—1 Y—3 Z —2

(B) (X—2 Y—1 Z –3
(C) X—3 Y—2 Z–1
(D) X—3 Y—1 Z–2


Answer: (D)

Explanation: See https://www.geeksforgeeks.org/c-dynamic-memory-allocation-question-1/

Quiz of this Question


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads