CIS 1500 Lecture Notes - Lecture 18: Semicolon
Document Summary
Typedef typedef is how you give aliases to things in c. similar to #define but not quite. They can help make code more readable example: typedef unsigned int uint; uint mynum = 2000; You can typedef basically anything so be careful and sensible. Don"t be cute. typedefs are often used with structs. Structs: a structure is a programmer-defined data type. Example: struct date { int day; int month; int year; Structures can be statically allocated (from the stack) just like other variable types. /* structure definition */ struct date { int day; int month; int year; int * ptr; /* structure allocation */ int main(void) { struct date birthday; birthday. day = 15; birthday. month = 11; birthday. year = 1800; birthday->ptr = 2; The dot operator is used to access regular components of a structure. If your struct has a pointer variable type, the access operator changes to the -> operator.