6_5_15_02_conditional_uchar_eof.c (317B)
1 typedef unsigned long kit_size_t; 2 3 struct Zio { 4 kit_size_t n; 5 const char* p; 6 }; 7 8 static int fill(void) { return -1; } 9 10 static int get(struct Zio* z) { 11 return ((z)->n-- > 0) ? (unsigned char)(*(z)->p++) : fill(); 12 } 13 14 int test_main(void) { 15 struct Zio z = {0, ""}; 16 int c = get(&z); 17 return c == -1 ? 42 : c; 18 }