Welcome Guest | Sign in | Register
Inbuilt Functions - Discussion Page For Q.10691 | C Programming Questions and Answers | C Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Inbuilt Functions > Questions and Answers

Q: What will be the output of following C code?
void main()
{
int *mptr, *cptr;
mptr = (int*)malloc(sizeof(int));
printf(ā€œ%dā€,*mptr);
int *cptr = (int*)calloc(sizeof(int),1);
printf(ā€œ%dā€,*cptr);
}
A. 1 B. Garbage-value 0
C. Error D. None of these

Answer and Explanation

Answer:Garbage-value 0

Explanation:
The memory space allocated by malloc is uninitialized, whereas calloc returns the allocated memory space initialized to zeros.

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.