A definition allocates memory for a variable and can occur only once in a program (following the one definition rule). A declaration tells the compiler about the variable's type and name without allocating memory, and can appear multiple times. For example, extern int x; is a declaration, while int x = 5; is a definition.