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 |
What is structure padding and packing in c?
plz answer.. a program that takes a string e.g. "345" and returns integer 345
What do you mean by keywords in c?
a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor
Is fortran still used today?
can we initialize all the members of union?
What is the modulus operator?
Predict the output or error(s) for the following: 25. main() { printf("%p",main); }
Explain the Difference between the New and Malloc keyword.
What is the difference between formatted&unformatted i/o functions?
c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above
is forign key will be unique key any table or not?