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 |
How can I change their mode to binary?
Draw a flowchart to produce a printed list of all the students over the age of 20 in a class .The input records contains the name and age of students. Assume a sentinel value of 99 for the age field of the trailer record
how to find sum of digits in C?
write a program to search for an element in a given array. If the array was found then display its position otherwise display appropriate message in c language
Write a main() program that calls this function at least 10 times. Try implementing this function in two different ways. First, use an external variable to store the count. Second, use a local variable. Which is more appropriate?
What is the difference between ++a and a++?
what are # pragma staments?
a C prog to swap 2 no.s without using variables just an array?
who did come first hen or agg
hi, which software companys will take,if d candidate's % is jst 55%?
Write a program to use switch statement.
0 Answers Agilent, Integreon, ZS Associates,
Why do some versions of toupper act strangely if given an upper-case letter?