Variables
- 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
- Global variables are ____________.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
External
- Which of the following is an external variable in the following C code?
#include <stdio.h>
int function(int p)
{
int q;
return q;
}
int main()
{
int r;
function(r);
}
int s;
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
s
- 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
- 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