Home

Search IconIcon to open search

C and C++ lingo

# declaration vs definition

Declaration - you’re telling the compiler “there’s something with this name, and it has this type”. Example:

1
int hello();

Definition - providing all the details. For functions it means providing function body. Example:

1
2
3
4
int hello()
{
  return 420;
}

For more info see:
What’s the difference between declaring and defining in C and C++

# Translation unit

Take a .c file, put in a preprocessor - you get a translation unit that is turned into an .o file after compilation. See also on Wikipedia.