I know there must be a duplicate, but I didn't find anything. In C, I see a lot of code examples where the authors only assign values after the declaration of the variable, is there a good reason for doing that?
int main(void)
{
int x; // declare "x"
x = 5; // assign 5 to "x"
return 66;
}
And what's the different between that and just declaring and assigning a value in one line?
int main(void)
{
int x = 5; // declare "x" and assign in the same line
return 66;
}