893 views
0 votes
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 votes
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

Related questions

1 votes
1 votes
0 answers
1
Akash Kumar Roy asked Mar 27, 2018
373 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 votes
0 votes
1 answer
2
yuyutsu asked Jul 3, 2022
796 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?
0 votes
0 votes
1 answer
3
Hira Thakur asked Aug 18, 2017
1,653 views
how enum has differed from marco???what is advantage/disadvantage of both???