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?
Answer Posted / 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 |
Post New Answer View All Answers
Tell me what is null pointer in c?
What is pointers in c with example?
Does c have enums?
Write the syntax and purpose of a switch statement in C.
What is a pointer on a pointer in c programming language?
What are the advantages of union?
Explain what is wrong with this program statement? Void = 10;
How is actual parameter different from the formal parameter?
Write a program to reverse a given number in c?
Wt are the Buses in C Language
What is conio h in c?
Explain how do you view the path?
int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above
Explain the red-black trees?
Is that possible to add pointers to each other?