As per my understanding when you say ;
int var; // it is a declaration because no value stored in var
But when you do ;
int var = 90; // it is a definition because var got its value
Reason to ask this question is that I am following book and internet for programming. But, I see everywhere different meaning of definition and declaration. Please clarify , If you know better ?
Some people are saying that both are definitions , if that's the case why program below gives " redeclaration error " instead of "redifination error" in gcc.
int main(){
int var = 100;
int var;
return 0;
}
Error while compiling :