main()
{ int i=5;
printf("%d",++i + i);
} output is 10
------------------------
main()
{ int i=5;
printf("%d",i++ + i);
}output is 12
why it is so? give appropiate reason....
Answers were Sorted based on User's Feedback
Answer / sudarsan.tuku@gmail.com
1>On the 1st que the ans. is 12
bcz perform the pre increment 1st then add them.
After the pre increment the value of i becomes 6 and
then it perform the add operation i.e. i+i=6+6=12.
2>output is 10
It 1st perform the pre operation but there is no pre
operation in the que.
2ndly it perform the operation i.e i+i=5+5=10.
3rdly it perform post operation i.e i++ so i becomes 6.
but here the output is 10.
| Is This Answer Correct ? | 16 Yes | 2 No |
Answer / ashi smita
in first program i is post increment than i=5 and i=5+5=10
than i is increment by 1 and the value of i is 6 but second
program first i is preincrement by 1 and the value of is 6
than sum of i is 12.
| Is This Answer Correct ? | 3 Yes | 10 No |
1. Write the function int countchtr(char string[ ], int ch); which returns the number of times the character ch appears in the string. Example, the call countchtr(“She lives in NEWYORK”, ‘e’) would return 3.
How pointer is different from array?
How to find a missed value, if you want to store 100 values in a 99 sized array?
What are the advantages of c language?
1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
What is the difference between break and continue?
What should malloc() do?
why programming language C is still used in operating system's kernel??
a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor
Explain how can I prevent another program from modifying part of a file that I am modifying?
what will be the output of "printf("%d%d",scanf("%d% d",&a,&b))".provide an explation regarding the question
what is inline function?