Top

Discussion

What is the output of this program?

#include 
#include  
int main()
{
  int i, numbers[1];
  numbers[0] = 15;
  free(numbers);
  printf("Stored integers are ");
  printf("numbers[%d] = %d ", 0, numbers[0]);
  return 0;
}

 

  • A.15
  • B.Compilation error
  • C.garbage value

Answer: A

he memory allocation function free() will not free or delete the content in the memory location, because free() can only free or delete the content in the memory, who's memory is allocated either by malloc() or calloc().

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

Post your comment