Advertisement
homer512

ternary type promotion

Sep 25th, 2014
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.29 KB | None | 0 0
  1. #include <stdio.h>
  2. /* using printf */
  3. #include <stdint.h>
  4. /* using int64_t */
  5. #include <inttypes.h>
  6. /* using PRId64 */
  7.  
  8. int main()
  9. {
  10.   int64_t i = 1000000000000ll;
  11.   float f = 0.f;
  12.   int64_t x = i > 0 ? i : f;
  13.   printf("%"PRId64"\n", i - x);
  14.   /* prints 4096 */
  15.   return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement