0
Can you give an example of a simple code in C which gives different outputs with different compilers?? Anyone,,,
It can be a simple code.
2 Answers
+ 6
The easiest is to print an uninitialized variable. The value in memory will be dependent on both the compiler and OS.
Using #ifdef, you could detect which compiler and write two different programs.
+ 1
I like the #ifdef route as uninitialised vars will give erratic values on the same compiler. Martin has a great example:
https://code.sololearn.com/cgAiPP77spmp/?ref=app