C Programming - Memory Allocation - Discussion
Discussion Forum : Memory Allocation - Find Output of Program (Q.No. 2)
2.
What will be the output of the program (16-bit platform)?
#include<stdio.h>
#include<stdlib.h>
int main()
{
int *p;
p = (int *)malloc(20);
printf("%d\n", sizeof(p));
free(p);
return 0;
}
Discussion:
31 comments Page 4 of 4.
Balaramana said:
2 years ago
As we all know that, the size of the data type depends on the compiler and I also got the Output as 8 when I run it on the online compiler. In this case, the Compiler size is less so that the Output is 2.
(1)
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers