I found this in a tutorial, and they don't explain any difference between these two. I don't get what typedef does, since the final outcome is the same (assigning values to vars declared as those structs, and then printing them)
Code:
typedef struct _MONEY { // Create a structure called "_MONEY"
int Dollars; // We want a variable to hold the Dollars, so we choose an integer. (ex, 1, 2 333, 1200000) Whole number
double Cents; // Then we want a variable to hold the Cents, so we choose a double. (ex, .00003, .02, etc) Floating point number (decimal number)
} MONEY; // Here is our alias, "MONEY". We now have a variable of our own to use. "MONEY" now means "struct _MONEY"
// I create two of the same type of structures to show the difference.
struct TEMP { // Here is just a regular structure, without the typedef.
int Dollars; // We want a variable to hold the Dollars, so we choose an integer. (ex, 1, 2 333, 1200000) Whole number
double Cents; // Then we want a variable to hold the Cents, so we choose a double. (ex, .00003, .02, etc) Floating point number (decimal number)
};