1,247 views
0 0 votes
When I compiled this program in two different compiler then I got two different result why it is so?

#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
    int a = 3;
    printf("%d%d", a++,++a);
    return 0;
}
Producing different output:-

1. Turbo -> 44

2. GCC  -> 45

1 Answer

0 0 votes
in C and C++ order of execution of function parameters is left undefined

and printf is a function

therefore it is implementation dependent
Position:
Show:

Related questions

1 1 vote
0 0 answers
824
824 views
Akash Kumar Roy asked Mar 27, 2018
824 views
What is gcc and GNU and how are they connected to a compiler? Please someone clear the whole mess. I tried google but it seems more complex to me.
0 0 votes
1 1 answer
2.2k
2.2k views
Hira Thakur asked Aug 18, 2017
2,168 views
how enum has differed from marco???what is advantage/disadvantage of both???
8 8 votes
1 answers 1 answer
7.9k
7.9k views
ManojK asked Mar 10, 2017
7,879 views
Program 1:#include<stdio.h int main() { float x = 0.1; if (x == 0.1) printf("IF"); else if (x == 0.1f) printf("ELSE IF"); else printf("ELSE"); }The output of above progra...
0 0 votes
1 1 answer
1.2k
1.2k views
yuyutsu asked Jul 3, 2022
1,179 views
Hi, can anyone please suggest me an online site where I can run code in C and test how the code will act under bid endian environment?