Give the logic for this
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a=10,b;
b=++a + ++a;
printf("%d", b);
getch();
}
Output: 24......How?
Answers were Sorted based on User's Feedback
Answer / suman halder
++a is an unary expression which signifies pre-increment operation...so ,pre-increment will be evaluated before the binary operation takes place..
b=++a + ++a;
here,a will be incremented twice and then binary operation is performed...
so,
b=12+12 which produces 24...
| Is This Answer Correct ? | 6 Yes | 3 No |
in first increment the a will become 11. And the second
increment the a will become 12. b=++a + ++a ; have same
variable so b=12+12=24
| Is This Answer Correct ? | 5 Yes | 5 No |
Write the control statements in C language
Explain how can you avoid including a header more than once?
What are the types of c language?
What are nested functions in c?
What are pointers really good for, anyway?
How can a number be converted to a string?
application of static variables in real time
What is the purpose of main() function?
What are multidimensional arrays?
Which driver is a pure java driver
Where are some collections of useful code fragments and examples?
What is the difference between null pointer and void pointer
10 Answers CTS, Manforce, MAQ Software,