Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22463

GCC strange behavior under bad conversion specification [duplicate]

$
0
0

This is a simple code to check the behavior of GCC handling conversion specifications.(i know the warnings and so on, but i just play with the conversions)

#include <stdio.h>int main(){  int i = 15;  float x = 5.53f;  printf("i = %d, x = %f\n", i, x);  printf("i = %f, x = %d\n", i, x);  return 0;}

the output is what make it quite confusing for me because it swaps the two values in printing, the output is :

i = 15, x = 5.530000i = 5.530000, x = 15

Can anyone explain this behavior ?


Viewing all articles
Browse latest Browse all 22463


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>