Top

Discussion

What is the output of this program?

#include 
#include  
int main()
{
  int *p;
  p = (int *)malloc(40);
  printf("%d", sizeof(p));
  free(p);
  return 0;
}

 

  • A.40
  • B.50
  • C.30
  • D.20

Answer: C

Since p is the pointer variable of integer type, thus the size of integer type is 4.

No comment is present. Be the first to comment.
Loading…

Post your comment