Operators
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int n = 15, m = 15;
if (n = 10)
m--;
printf("%d, %d", n, m--);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
10, 14
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int k = 3;
int L = ++k + k;
printf("%d\n", L);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
8
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int k = 2;
int L = k++ + k;
printf("%d\n", L);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
5
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int k = 3;
int k = k++ + k;
printf("%d\n", k);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Compilation Error
main.c: In function ‘main’:
main.c:5:13: error: redefinition of ‘k’
int k = k++ + k;
^
main.c:4:13: note: previous definition of ‘k’ was here
int k = 3;
- For which of the following, “PI++;” code will fail?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
#define PI 3.14