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 does pointer work in c?
How will you write a code for accessing the length of an array without assigning it to another variable?
Explain the use of function toupper() with and example code?
Convert the following expression to postfix and prefix X $ Y Z - M + N + P / Q / (R + S)
Explain bit masking in c?
Explain how do you list files in a directory?
the output will be #include<stdio.h> int main () { int i; i = 9/2; printf("%i",i); return 0; }
write a program to find the frequency of a number
main() { unsigned int k = 987 , i = 0; char trans[10]; do { trans[i++] =(char) (k%16 > 9 ? k%16 - 10 + 'a' : '\0' ); } while(k /= 16); printf("%s\n", trans); }
what is difference between array and structure?
44 Answers College School Exams Tests, CTS, Google, HCL, IBM, Motorola, TCS,
What does the characters “r” and “w” mean when writing programs that will make use of files?
What is c value paradox explain?