Answers

Question and Answer:

  Home  Linux Shutdown and Startup

⟩ Please tell me output of this program? #include<stdio.h> #include<stdlib.h> int main() { int *ptr; ptr = (int *)calloc(1,sizeof(int)); if (ptr != 0) printf("%dn",*ptr); return 0; } a) 0 b) -1 c) garbage value d) none of the mentioned

a) 0

Explanation:

The memory allocated by calloc() contains 0 until process does not make any change to it.

Output:

[root@localhost google]# gcc -o san san.c

[root@localhost google]# ./san

0

[root@localhost google]

 118 views

More Questions for you: