in Programming in C edited by
703 views
1 vote
1 vote
#include ‬<stdio.h>

int main(){
    int i = 4;
    i = printf(" %d ", ++i) + printf(" %d ", i--);
    printf(" %d ", i);
}
in Programming in C edited by
703 views

2 Comments

is the ans 8 ??
0
0
no
0
0

2 Answers

3 votes
3 votes

1 comment

what will be the final value of i??
0
0
0 votes
0 votes

This is Undefined behavior in C language.

Here are some which are also undefined Example in C language.

edited by

4 Comments

printf returns no of characters printed i=3+3=6
1
1

@Avdhesh Singh Rana right final value of i will be 6

0
0

@Manoj Goswami how you have decided that which "printf" will evaluate first?

0
0
edited by
I know this is compiler dependent .How you getting the result ?
0
0

Related questions