main()
{
int i=5;
printf("%d%d%d%d%d%d",i++,i--,++i,--i,i);
}
Answers were Sorted based on User's Feedback
Answer / abdul ahad
45545
because the expiration will executed from right to left and will print from left to right.
at the execution time from right i=5,--i=4,++i=5,i--=5 then decremented to4,now i++=4 ,then incremented to 5.
So the output will be left to right 45545
| Is This Answer Correct ? | 105 Yes | 60 No |
Answer / prashant nair
Ans: It really much more depend on compiler.
The logic/rules made should take us to the answer 45545 but compiler does also give answer as 45555 :O
source:
http://code.hackerearth.com/bddbb9e
http://ideone.com/t5fbbd
| Is This Answer Correct ? | 45 Yes | 9 No |
Answer / susie
Answer :
45545
Explanation:
The arguments in a function call are pushed into
the stack from left to right. The evaluation is by popping
out from the stack. and the evaluation is from right to
left, hence the result.
| Is This Answer Correct ? | 21 Yes | 11 No |
Answer / rishit
And will be
4 5 5 4 5 and 1 garbage value as there are
6 %d in printf statement
| Is This Answer Correct ? | 7 Yes | 2 No |
Answer / moschops
This is UNSPECIFIED BEHAVIOUR. It's possible to work out exactly what your particular compiler decided to do this one particular time, but other compilers are free to do it differently (and probably will). Put the code into some different compilers and you'll see different results. The order that parameters are evaluated is unspecified and left up to the compiler.
If you can explain what the compiler happens to do this one particular time, that's nice but completely useless, but anyone who actually wrote code like this should be fired.
| Is This Answer Correct ? | 10 Yes | 6 No |
Answer / dharmendra
(i++,i--,++i,--i,i)
(4 , 5, 5 , 4 ,5)
explanation:
executed from right to left
and
print left to right.
| Is This Answer Correct ? | 11 Yes | 7 No |
Write a routine that prints out a 2-D array in spiral order
How to use power function under linux environment.eg : for(i=1;i<=n;i++){ pow(-1,i-1)} since it alerts undefined reference to 'pow'.
#include<stdio.h> #include<conio.h> void main() { int a=(1,2,3,(1,2,3,4); switch(a) { printf("ans:"); case 1: printf("1");break; case 2: printf("2");break; case 3: printf("1");break; case 4: printf("4");break; printf("end"); } getch(); }
How we print the table of 3 using for loop in c programing?
#define FALSE -1 #define TRUE 1 #define NULL 0 main() { if(NULL) puts("NULL"); else if(FALSE) puts("TRUE"); else puts("FALSE"); }
WAP to display 1,2,3,4,5........N
How do you verify if the two sentences/phrases input is an anagram using predefined functions in string.h and by using arrays?
how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.
0 Answers Mbarara University of Science and Technology,
What is wrong with the following code? int *foo() { int *s = malloc(sizeof(int)100); assert(s != NULL); return s; }
abcdedcba abc cba ab ba a a
I need your help, i need a Turbo C code for this problem.. hope u'll help me guys.? Your program will have a 3x3 array. The user will input the sum of each row and each column. Then the user will input 3 values and store them anywhere, or any location or index, temporarily in the array. Your program will supply the remaining six (6) values and determine the exact location of each value in the array. Example: Input: Sum of row 1: 6 Sum of row 2: 15 Sum of row 3: 24 Sum of column 1: 12 Sum of column 2: 15 Sum of column 3: 18 Value 1: 3 Value 2: 5 Value 3: 6 Output: Sum of Row 1 2 3 6 4 5 6 15 7 8 9 24 Sum of Column 12 15 18 Note: Your program will not necessary sort the walues in the array Thanks..
main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }
9 Answers CSC, GoDB Tech, IBM,