void main()
{
int i=1;
printf("%d%d%d",i,++i,i++);
}
Cau u say the output....?
Answers were Sorted based on User's Feedback
Answer / subash
221
because it starts executing from right to left
so it first executes i++(the increment will happen when
entire printf statement is executed so now ++i which means
it is the pre incremant so now i becomes 2
Is This Answer Correct ? | 2 Yes | 3 No |
Answer / kiran
The output will be 1 2 2...
First the assigned value of i(1) is printed. Then (++i) prints the Incremented value of i which is 2 will be printed.
Now as the Postfix operator only prints thhe value first and then increments...so the value of i is again 2..
Is This Answer Correct ? | 4 Yes | 5 No |
Answer / we r the new inventors
the explanation above are also correct but think they are somewhat wrong because it was post increment of i.so value of i will become 2..
Is This Answer Correct ? | 1 Yes | 2 No |
Answer / we are the new inventors
above answers are also right but i think they are somewhat wrong..because its a post increment of i so ans will become 2...
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / sums
The ans is obv 3 3 1...
The explanations given are also correct
For all those u r giving other answers without even giving the reason should at least run the program in "gcc" before writing anything
Is This Answer Correct ? | 2 Yes | 4 No |
Answer / pratik
answer is 1 1 2 ..
it is an example of stack type ..
Is This Answer Correct ? | 0 Yes | 4 No |
UINT i,j; i = j = 0; i = ( i++ > ++j ) ? i++ : i--; explain pls....
I'm having trouble with coming up with the correct code. Do I need to put a loop? Please let me know if I'm on the right track and what areas I need to correct. I still don't have a good grasp on this programming stuff. Thanks =) The assignment was to write a program using string functions that accepts a coded value of an item and displays its equivalent tag price. The base of the keys: 0 1 2 3 4 5 6 7 8 9 X C O M P U T E R S Sample I/O Dialogue: Enter coded value: TR.XX Tag Price : 68.00
how tally is useful?
How to create a program that lists countries capitals when country is entered? (Terribly sorry, I'm a complete novist to coding with C, am looking for inspiration and general tips on how to code and create this program.)
Assume that the int variables i and j have been declared, and that n has been declared and initialized. Write code that causes a "triangle" of asterisks of size n to be output to the screen. Specifically, n lines should be printed out, the first consisting of a single asterisk, the second consisting of two asterisks, the third consistings of three, etc. The last line should consist of n asterisks. Thus, for example, if n has value 3, the output of your code should be * ** *** You should not output any space characters. Hint: Use a for loop nested inside another for loop.
void main() { int i=7; printf("N= %*d",i,i); }
what is run time error?
Find the error (2.5*2=5) (a) X=y=z=0.5,2.0-5.75 (b) s=15;
printy(a=3,a=2)
void main() { int i=5,y=3,z=2,ans; clrscr(); printf("%d",++i + --z + i++ + --i * ++y); i=5,y=3,z=2; ans=++i + --z + i++ + --i * ++y; printf("\n%d",ans); getch(); } Its output is 37 and 31.... Please explain me why its different How it works.....
char* f() return "hello:"; void main() {char *str=f(); }
void main() { for(int i=0;i<5;i++); printf("%d",i); } What is the output?..
32 Answers College School Exams Tests, CTS, HCL, iGate, SmartData,