Question & Answer: Consider the following C code snippet: int *p: int l = p, k: k = realloc(p, 2 * sizeof (char)): printf ("%d", k): is the code seg…..

6) Consider the following C code snippet: int *p int 1 P, k: k- realloc(p, 2sizeof (char)) printf (ad, k) i is the code segment correct or error. If correct what is the output? a) Garbage value b) Address of K c) Error d) None of the above

Consider the following C code snippet: int *p: int l = p, k: k = realloc(p, 2 * sizeof (char)): printf (“%d”, k): is the code segment correct or error. If correct what is the output? a) Garbage value b) Address of K c) Error d) None of the above a b c d

Expert Answer

 

Answer is A

Because it initialiseing the value from realloc but it can’t set any value so it will print Garbage value.

Still stressed from student homework?
Get quality assistance from academic writers!