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 are the application of void data type in c?
What is local and global variable in c?
Explain the difference between the local variable and global variable in c?
program in c to print 1 to 100 without using loop
Write a C program to find the smallest of three integers, without using any of the comparision operators.
Write a program to find the number of times that a given word(i.e. a short string) occurs in a sentence (i.e. a long string!). Read data from standard input. The first line is a single word, which is followed by general text on the second line. Read both up to a newline character, and insert a terminating null before processing. Typical output should be: The word is "the". The sentence is "the cat sat on the mat". The word occurs 2 times.
What are comments and how do you insert it in a C program?
What is pointer to pointer in c language?
Write a C program to convert an integer into a binary string?
write a program which will count occurance of a day between two dates.
Which function in C can be used to append a string to another string?
write a c program to accept a given integer value and print its value in words
4 Answers Vernalis, Vernalis Systems,