#include<stdio.h>
int main()
{
int i=2;
int j=++i + ++i + i++;
printf("%d\n",i);
printf("%d\n",j);
}
Answer Posted / vadim g
i=5 and j=12
Here is the sequence of operations:
1. i = 2 => result i = 2
2. first ++i => result: i = 3
3. second ++i => result: i = 4
4. j assignment => result: j = 4 + 4 + 4 = 12
5. i post increment => i = 5
MSVC++ gives 5 and 12.
| Is This Answer Correct ? | 4 Yes | 3 No |
Post New Answer View All Answers
Describe how arrays can be passed to a user defined function
Why does notstrcat(string, "!");Work?
What tq means in chat?
A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none
Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.
Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].
Why is c called a structured programming language?
What is the difference between single charater constant and string constant?
please give me a VIRTUSA sample palcement papers.... you will only send TECHNICAL SECTION..... that is help for me Advance Thanks........................
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same
What are the advantages and disadvantages of a heap?
How do we make a global variable accessible across files? Explain the extern keyword?
Is malloc memset faster than calloc?
What do you mean by dynamic memory allocation in c? What functions are used?
find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2