C Programming :: Basic Concepts - Discussion
Home > C Programming > Basic Concepts > MCQs Questions Discussion
9 / 90
What is the output of the following C Program?
#include<stdio.h>
int main()
{
int c=- -2;
printf("c=%d",c);
return 0;
}
#include<stdio.h>
int main()
{
int c=- -2;
printf("c=%d",c);
return 0;
}
Ac=-2
Bc=2
CGarbage Value
DCompiler Error
Answer: Option (Login/Signup)
Show Explanation
Asked In ::
STEP-BY-STEP
Line 4 => int c= - - 2; can also be understood as int c= -(-2), which is c=2.
Hence, output is 2
If, it would have been something like int c= - - - 2, then it would have meant nothing but c=-(-(-2)), which is c=-2.
Hence, option B is correct.
Read Full Answer
Report Error
Please Login First Click Here