I l@ve RuBoard Previous Section Next Section

28.2 struct

In C++, when you declare a struct, you can use the structure as a type name. For example:

struct sample {
    int i, j;    // Data for the sample
};
sample sample_var;  // Last sample seen

C is more strict. You must put the keyword struct before each variable declaration:

struct sample sample_var;  // Legal in C
sample sample_var;          // Illegal in C 
    I l@ve RuBoard Previous Section Next Section