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
What is the difference between test design and test case design?
If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402
What are the standard predefined macros?
Write the control statements in C language
Explain the ternary tree?
Explain what are the __date__ and __time__ preprocessor commands?
Can one function call another?
What is meant by gets in c?
How to establish connection with oracle database software from c language?
What are nested functions in c?
Write a program of advanced Fibonacci series.
1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.
What's the total generic pointer type?
Explain what standard functions are available to manipulate strings?
What is c value paradox explain?