Struct Declaration
Struct Declaration

Here is an example of a struct that I might want to use when recording grades:

struct book { char author[40]; char title[40]; int edition; int callNumber; float price; };
In this struct, we can see by looking at it that the name of the struct is book. That is how we can identify which struct we want to create later in the main program if we have declared more than one. We also know that the information each item or type "struct book" will contain a 2 character strings, 2 ints and a float.

We could declare this struct as seen below:

struct book new; struct book old, multiple;


Main Page
Last Modified 17 October 2000