Home Segments Index Top Previous Next

679: Mainline

Recall that a function prototype is a declaration, because it provides the C compiler with information about a function that is defined elsewhere.

Analogously, you can declare a global variable in one place and define it in another. As explained in Segment 129, when you define a global variable, you tell the compiler to allocate a chunk of memory for the variable. When you declare a global variable, you tell the compiler that the global variable is defined in an object file available to the C linker when it is time to link together object files into an executable program.