1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <stdint.h>
4
5 typedef float RealNumber; // should show as char
6 typedef RealNumber Temperature; // should show as float
7 typedef RealNumber Speed; // should show as hex
8
9 typedef int Counter; // should show as int
10 typedef int BitField; // should show as hex
11
12 typedef BitField SignalMask; // should show as hex
13 typedef BitField Modifiers; // should show as hex
14
15 typedef Counter Accumulator; // should show as int
16
17 typedef int Type1; // should show as char
18 typedef Type1 Type2; // should show as hex
19 typedef Type2 Type3; // should show as char
20 typedef Type3 Type4; // should show as char
21
22 typedef int ChildType; // should show as int
23 typedef int AnotherChildType; // should show as int
24
25 struct Point {
26 int x;
27 int y;
PointPoint28 Point(int X = 3, int Y = 2) : x(X), y(Y) {}
29 };
30
31 typedef float ShowMyGuts;
32
33 struct i_am_cool
34 {
35 int integer;
36 ShowMyGuts floating;
37 char character;
i_am_cooli_am_cool38 i_am_cool(int I, ShowMyGuts F, char C) :
39 integer(I), floating(F), character(C) {}
i_am_cooli_am_cool40 i_am_cool() : integer(1), floating(2), character('3') {}
41
42 };
43
44 struct i_am_cooler
45 {
46 i_am_cool first_cool;
47 i_am_cool second_cool;
48 ShowMyGuts floating;
49
i_am_cooleri_am_cooler50 i_am_cooler(int I1, int I2, float F1, float F2, char C1, char C2) :
51 first_cool(I1,F1,C1),
52 second_cool(I2,F2,C2),
53 floating((F1 + F2)/2) {}
54 };
55
56 struct IUseCharStar
57 {
58 const char* pointer;
IUseCharStarIUseCharStar59 IUseCharStar() : pointer("Hello world") {}
60 };
61
main(int argc,const char * argv[])62 int main (int argc, const char * argv[])
63 {
64
65 int iAmInt = 1;
66 const float& IAmFloat = float(2.45);
67
68 RealNumber RNILookChar = 3.14;
69 Temperature TMILookFloat = 4.97;
70 Speed SPILookHex = 5.55;
71
72 Counter CTILookInt = 6;
73 BitField BFILookHex = 7;
74 SignalMask SMILookHex = 8;
75 Modifiers MFILookHex = 9;
76
77 Accumulator* ACILookInt = new Accumulator(10);
78
79 const Type1& T1ILookChar = 11;
80 Type2 T2ILookHex = 12;
81 Type3 T3ILookChar = 13;
82 Type4 T4ILookChar = 14;
83
84 AnotherChildType AHILookInt = 15;
85
86 Speed* SPPtrILookHex = new Speed(16);
87
88 Point iAmSomewhere(4,6);
89
90 i_am_cool *cool_pointer = (i_am_cool*)malloc(sizeof(i_am_cool)*3);
91 cool_pointer[0] = i_am_cool(3,-3.141592,'E');
92 cool_pointer[1] = i_am_cool(0,-3.141592,'E');
93 cool_pointer[2] = i_am_cool(0,-3.141592,'E');
94
95 i_am_cool cool_array[5];
96
97 cool_array[3].floating = 5.25;
98 cool_array[4].integer = 6;
99 cool_array[2].character = 'Q';
100
101 int int_array[] = {1,2,3,4,5};
102
103 IUseCharStar iEncapsulateCharStar;
104
105 char strarr[32] = "Hello world!";
106 char* strptr = "Hello world!";
107
108 i_am_cooler the_coolest_guy(1,2,3.14,6.28,'E','G');
109
110 return 0; // Set break point at this line.
111 }
112
113