1 typedef unsigned long count_t; 2 typedef int (*int_op)(int); 3 typedef int (*int_op2)(int, int); 4 5 typedef struct { 6 count_t times; 7 int_op op; 8 } op_sequence; 9 10 int_op add; 11 12 // Global variable with unnamed function type 13 int (*another_int_op)(int); 14 15 // Function prototype 16 op_sequence do_ops(int_op op, count_t times); 17 18 // anonymous typedef 19 typedef union { 20 int i; 21 float f; 22 } IntOrFloat; 23 24 // Completely anonymous enum 25 enum { 26 RED = 0xff0000, 27 GREEN = 0x00ff00, 28 BLUE = 0x0000ff 29 }; 30 31 typedef enum SIZE { 32 XS, 33 S, 34 M, 35 L, 36 XL 37 } SIZE; 38 39 // Typedef anonymous enum 40 typedef enum { 41 Java, 42 C, 43 CPP, 44 Python, 45 Ruby 46 } codetype_t; 47 48 // declaration only 49 struct Point; 50 // definition 51 struct Point { 52 int i; 53 int j; 54 }; 55 // different name struct typedef 56 typedef struct Point POINT; 57 // layered typedef 58 typedef POINT point_t; 59 typedef point_t rectangle[4]; 60 61 rectangle canvas; 62 63 typedef int cordinate_t; 64 typedef cordinate_t location2D[2]; 65 typedef count_t dimensions[]; 66 typedef count_t *count_ptr; 67 68 // same name struct typedef 69 typedef struct Point3D { 70 int i; 71 int j; 72 int k; 73 } Point3D; 74 // User of same name typedef 75 void drawParamid(Point3D vertices[4]); 76 77 // anonymous types not references 78 struct { 79 int foo; 80 int bar; 81 }; 82 83 static union { 84 int i; 85 long l; 86 }; 87 88 // No way to declare anonymous function type 89 // But here is a function getFn to return a function type 90 void (*getFn(void))(int, count_t, int_op);