I am fairly new to structs and learning how to use typedef. I did the following code where i created a struct called rectangle. I want to manipulate the variables within it. Here is my code:
Expand|Select|Wrap|Line Numbers
- struct rectangle
- {
- int length, height;
- };
- typedef struct retangle rect;
- int main()
- {
- rect a; <--- LINE OF ERROR
- a.length = 5;
- printf("The length of rectangle is %d\n", a.length);
- }
struct.c:12: error: storage size of 'a' isn't known
What am I doing wrong? Regards.