Variables
- Which part of the program address space is p stored in the following C code?
#include <stdio.h>
int *ptr;
int main()
{
int n = 0;
ptr = &n;
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Bss segment
- Which part of the program address space is ptr stored in the following C code?
#include <stdio.h>
int *ptr = NULL;
int main()
{
int n = 0;
ptr = &n;
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Data segment
- What will be the output of the following C code?
#include <stdio.h>
double p;
int main()
{
printf("%g\n",p);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
0
- What will be the output of the following C code?
#include <stdio.h>
double n = 10;
int main()
{
int n = 6;
printf("%d", n);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
6
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
printf("%d", num++);
}
int num = 15;
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Compilation Error
main.c: In function ‘main’:
main.c:4:22: error: ‘d’ undeclared (first use in this function)
printf("%d", d++);
^
main.c:4:22: note: each undeclared identifier is reported only once for each function it appears in