The meaning of both eludes me.
相关问题
- Multiple sockets for clients to connect to
- What is the best way to do a search in a large fil
- glDrawElements only draws half a quad
- Index of single bit in long integer (in C) [duplic
- Equivalent of std::pair in C
According to the GNU C library manual (http://www.gnu.org/software/libc/manual/html_node/Header-Files.html)
Declaration: "Somewhere, there exists a foo."
Definition: "...and here it is!"
Stages of an executable generation:
In stage 2 (translator/compiler), declaration statements in our code tell to the compiler that these things we are going to use in future and you can find definition later, meaning is :
and (3) stage (linker) needs definition to bind the things
Rule of thumb:
A declaration tells the compiler how to interpret the variable's data in memory. This is needed for every access.
A definition reserves the memory to make the variable existing. This has to happen exactly once before first access.