23. What will be the output of following code :
// Assume all header files are included
main()
{
int *ptr;
ptr=(int*)malloc(sizeof(int));
printf("If not assigned a value, the allocated object has %d",*ptr);
}
A. If not assigned a value, the allocated object has 0
B. If not assigned a value, the allocated object has 2342355[Address].
C. If not assigned a value, the allocated object has [Garbage Value]
D. Runtime Error
View Answer & Explanation
Ans. C
24. What will be the output of following code :
// Assume all header files are included
main()
{
int *ptr;
ptr=(int*)calloc(sizeof(int));
printf("If not assigned a value, the allocated object has %d",*ptr);
}
A. If not assigned a value, the allocated object has 0
B. If not assigned a value, the allocated object has 2342355[Address].
C. If not assigned a value, the allocated object has [Garbage Value]
D. Runtime Error
View Answer & Explanation
Ans. A
