In which condition this program will print the string "Example"?
#include<stdio.h>
#include<stdlib.h>
int main()
{
int *ptr;
ptr = (int *)malloc(sizeof(int)*10);
if (ptr == NULL)
printf("Example\n");
return 0;
}
#include<stdio.h>
#include<stdlib.h>
int main()
{
int *ptr;
ptr = (int *)malloc(sizeof(int)*10);
if (ptr == NULL)
printf("Example\n");
return 0;
}A. if the memory could not be allocated to the pointer "ptr"
B. if the memory has been allocated to the pointer "ptr" example
C. it will never print
D. none of the mentioned
Answer: Option A

Join The Discussion