#include<stdio.h>
int main()
{
int i=2;
int j=++i + ++i + i++;
printf("%d\n",i);
printf("%d\n",j);
}
Answer Posted / sanjay
i = 5
j = 11
It is because during the first pre-increment "++i" the compiler gets the value from the memory, increments it and stores it in the memory ie now i = 3. During the second pre-increment "++i" the compiler again gets the value from the memory, increments it, (value in the memory was 3) and so the incremented value is stored again in memory ie i = 4. during the post increment, the value from the memory is received and used in the statement ie) (the whole final statement looks like this ->>( 3 + 4 + 4) ) and then value of i is incremented and stored in memory. thus finally the value of i is 5 and j is 11.
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.
What does node * mean?
What are dangling pointers? How are dangling pointers different from memory leaks?
How many bytes is a struct in c?
Explain what would happen to x in this expression: x += 15; (assuming the value of x is 5)
What is break in c?
Is there a way to switch on strings?
Write a program to print "hello world" without using a semicolon?
What is volatile variable in c with example?
we called a function and passed something do it we have always passed the "values" of variables to the called function. such functions calles are called a) calls by reference b) calls by value c) calls by zero d) none of the above
What are the different types of data structures in c?
in iso what are the common technological language?
What is the total generic pointer type?
How to declare pointer variables?
How is a null pointer different from a dangling pointer?