Consider the following code snippet
int main(){
int a, b, c;
printf("%d %d %d", a, b, c);
return 0;
}
This is going to display some garbage value.
Now, consider this snippet.
int main(){
int a, b, c = 0;
printf("%d %d %d", a, b, c);
return 0;
}
This displays 0 0 0
for every execution. But I've only initialized variable c
to 0
. Is this some shorthand for doing something like, int a=0, b=0, c=0;
Don't know how to look for such doubt in official documentation.