A declaration means there is code with this name somewhere in the program, the compiler reads in a linear fashion ex: line by line. If it come across a variable that is not declared it doesn't have a clue as to what it actually represents.
1 2 3 4 5 6 7 8 9 10 11 12 13
void dosomething(); // a declaration, if this statement wasnt here
// when main calls the dosomething function the compiler gets confused
// beacuse it hasnt read the definition yet.
int main()
{
dosomething(); // a function call
}
void dosomething() // a function definition
{
}
The same thing applies for variables, you must declare them before you use them.