What will be output of following program?
#include<stdio.h>
int main(){
int i = 100;
printf("value of i : %d addresss of i : %u",i,&i);
i++;
printf("\nvalue of i : %d addresss of i : %u",i,&i);
return 0;
}
(A)
value of i : 100 addresss of i : Address
value of i : 101 addresss of i : Address
(B)
value of i : 100 addresss of i : Address
value of i : 100 addresss of i : Address
(C)
value of i : 101 addresss of i : Address
value of i : 101 addresss of i : Address
(D) Compilation error
(E) None of above
________________________________________
Explanation:
Turbo C++ 3.0:
value of i : 100 addresss of i : Address
value of i : 101 addresss of i : Address
Turbo C ++4.5:
value of i : 100 addresss of i : Address
value of i : 101 addresss of i : Address
Linux GCC:
value of i : 100 addresss of i : Address
value of i : 101 addresss of i : Address
Visual C++:
value of i : 100 addresss of i : Address
value of i : 101 addresss of i : Address
Within the scope of any variable, value of variable may change but its address will never change in any modification of variable.
No comments:
Post a Comment