main()
{
int i=5;
printf("%d%d%d%d",i++,i--,i);
}
Answers were Sorted based on User's Feedback
Answer / sravan kumer
Answer is 455848 in 'Turbo C++'
because here gave 4 %d's but given variables to print are 3.
So here Turbo C++ will evaluate first 3 parameters given as
---> first i will be evaluated so i=5 because printf() evaluates from right to left.
---> then i-- is 5 because it is post decrement so 1st prints value and then increments i=4
---> then i++ is post increments so 1st prints i value i.e 4
and then it will be incremented to 5.
---> so it printf will print 455 but there is another %d ,printf will handle those with a garbage values i.e 848 here.
so answer is 455848.i.e 455 is common after that some garbage value will be printed.
Is This Answer Correct ? | 1 Yes | 0 No |
some garbage value , 4,5,5...
why in this o/p garbage value is because only 3 parameters
are passed but we have assigned 4 control strings , where
one control string is useless, so for that compiler will
print garbage value....
Is This Answer Correct ? | 2 Yes | 4 No |
Answer / sravankumar
printf() function evaluates from right to left
printf("\n %d %d %d",i++,i--,i);
4 5 5
<- <- <- <- <-evaluation of expression
but prints as the way we mentioned in printf() function
i.e first i = 5
then i--= 5 because it is post decrement
then i++= 4 this because i is decremented in above, and
not incremented immediately because is post
increment
So output is : 4 5 5
Is This Answer Correct ? | 0 Yes | 3 No |
Answer / sunil5a2
4 5 5
printf excutes form lefthand side onwords..
Is This Answer Correct ? | 0 Yes | 5 No |
What is the difference between arrays and pointers?
who is the father of c
what do structure language means?
How to delete a node from linked list w/o using collectons?
plz answer....A program that takes 3 variables e.g a,b,c in as seperate parameters and rotates the values stored so that value goes a to b, b to c and c to a .
PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE
if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0
main() { int i; printf("%d",scanf"%d",&i))//if the input is 12 24 34 then wat will be the output }
Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc
#define f(x) main() { printf("\n%d",f(2+2)); }
What is the main difference between calloc () and malloc ()?
"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above