Constants
- What will be the output of the following C code?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
r is carriage return and moves the cursor back. Inter is replaced by Mania.
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
printf("Interview\r\nMania\n");
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
rn combination makes the cursor move to the next line.
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
const int n;
n = 12;
printf("n is %d", n);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Since the constant variable has to be declared and defined at the same time, not doing it results in an error.
- What will be the output of the following C code?
#include <stdio.h>
void main()
{
int n = 21;
int *const m = &n;
int s = 12;
m = &s;
printf("%d", m);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Since the pointer m is declared to be constant, trying to assign it with a new value results in an error.
- Which of the following statement is false?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Since the constant variable has to be declared and defined at the same time, not doing it results in an error.