homer512 icon

ternary type promotion

homer512 | PRO | 09/25/14 05:27:01 PM UTC | 0 ⭐ | 634 👁️ | Never ⏰ | []
C |

290 B

|

None

|

0 👍

/

0 👎

#include <stdio.h>
/* using printf */
#include <stdint.h>
/* using int64_t */
#include <inttypes.h>
/* using PRId64 */
 
int main()
{
  int64_t i = 1000000000000ll;
  float f = 0.f;
  int64_t x = i > 0 ? i : f;
  printf("%"PRId64"\n", i - x);
  /* prints 4096 */
  return 0;
}

Comments