Solutions to Quiz 7: Structures

If you didn't as well as you wanted to, be sure to read through Cprogramming.com's tutorial on Structures in C. Otherwise, congratulations, you're well on your way to learning C!

1. Which of the following accesses a variable in structure b?
A. b->var;
B. b.var;
C. b-var;
D. b>var;

2. Which of the following accesses a variable in structure *b?
A. b->var;
B. b.var;
C. b-var;
D. b>var;

3. Which of the following is a properly defined struct?
A. struct {int a;}
B. struct a_struct {int a;}
C. struct a_struct int a;
D. struct a_struct {int a;};

4. Which properly declares a variable of struct foo?
A. struct foo;
B. struct foo var;
C. foo;
D. int foo;


Quiz
Next lesson: Lesson 8, arrays