main()
{int i=5; // line 1
i=(++i)/(i++); // line 2
printf("%d",i); // line 3
} output is 2 but if we replace line 2 and line 3 by
printf("%d",i=(++i)/(i++)); then output is 1. Why?
Answer / gagandeep bansal
working of incr/decr operator:first pre operators then
rest of operators then post operators
so,2 line become:i=6/(5++); /*pre operator*/
i=6/5=1; /*rest of operators*/
now post incr operator will work so,i=2; /*post operator*/
so output is 2.
in second case:i=6/(5++); /*pre operator*/
i=6/5==1; /*rest of operators*/
now post incr operator will work so,i=2;
again i=3/(2++);
i=1;
so,output is 1.
becouse in case of post operators first assign then
incr/decr.
| Is This Answer Correct ? | 9 Yes | 3 No |
What are different storage class specifiers in c?
why division operator not work in case of float constant?
What's wrong with the call "fopen ("c:\newdir\file.dat", "r")"?
main() { intj; while9j<=10) { printf("\n%d",j); j=j+1; } }
who developed c and why he developed c?
Can a local variable be volatile in c?
Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ?
What are the different types of data structures in c?
difference of two no's with out using - operator
3. When do you say that a digraph is acyclic A)if and only if its first search does not have back arcs B)a digraph is acyclic if and only if its first search does not have back vertices C)if and only if its first search does not have same dfnumber D)None of these
can any one provide me the notes of data structure for ignou cs-62 paper
What is the importance of c in your views?