C Questions: 1: Answer: 5794
C Questions: 1: Answer: 5794
main()
{ int x=20,y=35; x=y++ + x++; y= ++y + ++x; printf(%d%d\n,x,y); }
3.
void main() { int const * p=5; printf(%d,++(*p)); } Answer: Compiler error: Cannot modify a constant value.
Explanation: p is a pointer to a constant integer. But we tried to change the value of the constant integer.
4. main() { int c=- -2; printf(c=%d,c); } Answer: c=2; Explanation: Here unary minus (or negation) operator is used twice. Same maths rules applies, ie. minus * minus= plus. Note: However you cannot give like 2. Because operator can only be applied to variables as a decrement operator (eg., i). 2 is a constant and not a variable. 5. main() { int i=10; i=!i>14; printf(i=%d,i); } Answer: i=0 Explanation: In the expression !i>14 , NOT (!) operator has more precedence than > symbol. ! is a unary logical operator. !i (!10) is 0 (not of true is false). 0>14 is false (zero).