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
Was 2000 a leap year?
Explain what is a static function?
write a program to print largest number of each row of a 2D array
difference between Low, Middle, High Level languages in c ?
What is a pointer and how it is initialized?
Why doesnt the call scanf work?
in iso what are the common technological language?
What is the use of a semicolon (;) at the end of every program statement?
`write a program to display the recomended action depends on a color of trafic light using nested if statments
What language is windows 1.0 written?
What is the difference between memcpy and memmove?
how many types of operators are include in c language a) 4 b) 6 c) 8 d) 12
write an algorithm to display a square matrix.
what value is returned to operating system after program execution?
Declare the structure which contains the following members and write in C list of all students who score more than 75 marks. Roll No, Name, Father Name, Age, City, Marks.