A

Admin • 828.03K Points
Coach

Q. What will be the output?

Code:
int *p = malloc(sizeof(int) * 3);
if(p == NULL)
printf("Failed");
else
printf("Success");
  • (A) Failed
  • (B) Success
  • (C) Segmentation fault
  • (D) Depends on OS
  • Correct Answer - Option(B)
  • Views: 12
  • Filed under category C Programming
  • Hashtags:

Explanation by: Admin
If memory allocation succeeds, it prints 'Success'.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.