Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can different C compilers give different outputs for a C program? [closed]

Tags:

c

I have a doubt why it happens that different compilers give different outputs to a same C program.If there is an standard C then why these famous compiler dont use that completely. the difference in output is caused by 16-bit , 32-bit compilers so what are all those issues which makes the difference.

like image 996
raa one Avatar asked Mar 09 '26 08:03

raa one


1 Answers

Do you have an example?

The language is standardized, but a lot of aspects of it are implementation-defined or even undefined.

For example, this:

printf("sizeof (int) = %u\n", (unsigned)sizeof (int));

will print different numbers on different systems, depending on how big int is.

like image 178
Keith Thompson Avatar answered Mar 11 '26 01:03

Keith Thompson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!