There are conceivably [at least] four variants:
Code:
struct student {
char id[10];
char name[26];
int gradePoints;
};
The above defines a type called "struct student". You need to use "struct student <name>" to create a variable <name>, which can then be used to store the id, name and gradepoints.
Code:
struct {
char id[10];
char name[26];
int gradePoints;
} student;
Declares a variable called student, with an unnamed struct - this means that the struct can not be used to create any further variables than the statement it is in. This is very rarely useful, but there are situations where it can be useful.
Code:
struct student {
char id[10];
char name[26];
int gradePoints;
} student;
Declares a struct student type, then a variable called student. You can create further instances just like in the first variant. [1]
Code:
typedef struct student {
char id[10];
char name[26];
int gradePoints;
} student;
This declares a struct student, then declares a type of the name student as an "alias" name for that struct, so you can create a new variable struct student <name> by "student <name>".
[1] Note that in C++, an implicit typedef is made like the last example, and by using the same struct name and variable name, you are effectively hiding the implicit typedef. You can still use the C style "struct student <name>" to create further instances.
--
Mats