[ create a new paste ] login | about

Link: http://codepad.org/YX4Z4sgk    [ raw code | output | fork ]

C, pasted on Jul 8:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <stdbool.h>
#include <stdio.h>

#define X(Y) ((Y)?"true":"false")

int main(){
  printf("(int)true: %d\n",(int)true);
  printf("(int)(_Bool)6: %d\n",(int)(_Bool)6);
  printf("6 == true: %s\n",X( 6 == true ));
  printf("((_Bool)6) == 1: %s\n",X( ((_Bool)6) == 1 ));
  printf("!!6 == 1: %s\n",X( !!6 == 1 ));
  printf("!!6 == true: %s\n",X( !!6 == true ));
  return 0;
}


Output:
1
2
3
4
5
6
(int)true: 1
(int)(_Bool)6: 1
6 == true: false
((_Bool)6) == 1: true
!!6 == 1: true
!!6 == true: true


Create a new paste based on this one


Comments: