Statics vars allow a var to retain value for multiple declarations, does not reinitialize each time.
Static & extern are auto initialized to 0
Structures (Structure Type)
possible to aggregate components into a single named variables
IE: Bank Account – Account #, balance, interest, name, address
Structure is user defined. You can declare an array of structures
struct account {
long number;
float balance;
float interestRate;
} accnt2, myAccounts[3];
struct account myAccount;
Members can be accessed using structure member operator “.”
myAccount.number = 1248609385;
myAccount.balance = 1004.005;
myAccount.interestRate = 0.18237672;
Can declare a structure and then declare the variables
struct fruit {
char name[15];
int calories;
}
typedef struct fruit fruits;
struct fruit lunch = {“plum”,150}; // order is important
fruits dinner = {.calories=150,.name=”peach”}; // order not important
you can copy structs of the same type to each other dinner = lunch