C Programming - Memory Allocation - Discussion

Discussion Forum : Memory Allocation - Find Output of Program (Q.No. 1)
1.
What will be the output of the program?
#include<stdio.h>
#include<stdlib.h>

int main()
{
    int *p;
    p = (int *)malloc(20); /* Assume p has address of 1314 */
    free(p);
    printf("%u", p);
    return 0;
}
1314
Garbage value
1316
Random address
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
57 comments Page 6 of 6.

Shashank said:   2 decades ago
Saradhi is right. I checked in turboc.

Akash Musale said:   7 years ago
The answer is garbage value.
(1)

Dilpreet said:   2 decades ago
Please give the explanation.

Vijay said:   8 years ago
Please explain the program.

Omkar kuchekar said:   1 decade ago
Anyone expert knows answer?

Sweety said:   1 decade ago
Give me clear explanation.

Bhargavi said:   1 decade ago
Give me clear explanation.


Post your comments here:

Your comments will be displayed after verification.