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
Submitted by: Murtazaa) 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]
Submitted by: Murtaza
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]
Submitted by: Murtaza
Read Online Linux Startup and Shutdown Job Interview Questions And Answers
Top Linux Startup and Shutdown Questions
| ☺ | At the end of kernel bootstrap, which process is started? |
| ☺ | Single user mode shell runs as: |
| ☺ | Which is the only partition mounted in Single user mode? |
| ☺ | Which of the following is not a valid run-level? |
| ☺ | The shell used for Single user mode shell is: |
Top Linux OS Categories
| ☺ | Device Drivers Interview Questions. |
| ☺ | Linux OS Management Interview Questions. |
| ☺ | Linux Makefile Interview Questions. |
| ☺ | Linux Environment Interview Questions. |
| ☺ | Linux OS Shell Interview Questions. |
