Operators
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int n1 = 2, n2 = 2, n3;
n3 = n1++ + n2;
printf("%d, %d", n1, n2);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
3, 2
- What is the difference between the following 2 codes?
//Program 1
#include <stdio.h>
int main()
{
int n3, n1 = 2, n2 = 3;
n3 = n1++ + ++n2;
printf("%d %d %d", n3, n1, n2);
}//Program 2
#include <stdio.h>
int main()
{
int n3, n1 = 2, n2 = 3;
n3 = n1++ + +++n2;
printf("%d %d %d", n3, n1, n2);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Program 2 has syntax error, program 1 is not
- Relational operators cannot be used on ____________.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
structure
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int num = 12;
if (num == num--)
printf("TRUE 1\t");
num = 10;
if (num == --num)
printf("TRUE 2\t");
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
This is a sequence point problem and hence the result will be implementation dependent.
- Which among the following is NOT a logical or relational operator?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
=