scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

0187-zero_struct.c (341B)


      1 struct json_node {
      2 	int type;
      3 	char *name;
      4 };
      5 
      6 int
      7 main(void)
      8 {
      9 	struct json_node nodes[16] = { { 0 } };
     10 	char sentinel[] = {
     11 		0x98, 0x98, 0x98, 0x98,
     12 		0x98, 0x98, 0x98, 0x98,
     13 		0x98, 0x98, 0x98, 0x98,
     14 		0x98, 0x98, 0x98, 0x98,
     15 	};
     16 	int i;
     17 
     18 	for (i = 0; i < 16; i++) {
     19 		if (nodes[i].name || nodes[i].type)
     20 			return i+1;
     21 	}
     22 
     23 	return 0;
     24 }