Machine-translated by Google. Questions are authored in English.
Top

Discussion

What is the output of this program?

#include <stdio.h>
#include <stdlib.h>
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

Please log in or register to post a comment.