S
shaanxxx
I have following code .
#include<stdio.h>
int i;
int i;
int i;
int main()
{
printf("%d",i);
return 0;
}
It compiles fine .
now i modify above code to
#include<stdio.h>
int i = 0;
int i;
int i;
int main()
{
printf("%d",i);
return 0;
}
again it compiles fine.
now i introduce more change to above code
#include<stdio.h>
int i = 0;
int i = 0;
int i;
int main()
{
printf("%d",i);
return 0;
}
It gives me redefination Error.
Ok it means that statement 'int i;' is just a declaration. I guess, it
is not just a declaration since our very first code(code with all 'int
i;') compiled with no error. There exists atleast one defination of
'i'. what should we say to statement 'int i;' ?
#include<stdio.h>
int i;
int i;
int i;
int main()
{
printf("%d",i);
return 0;
}
It compiles fine .
now i modify above code to
#include<stdio.h>
int i = 0;
int i;
int i;
int main()
{
printf("%d",i);
return 0;
}
again it compiles fine.
now i introduce more change to above code
#include<stdio.h>
int i = 0;
int i = 0;
int i;
int main()
{
printf("%d",i);
return 0;
}
It gives me redefination Error.
Ok it means that statement 'int i;' is just a declaration. I guess, it
is not just a declaration since our very first code(code with all 'int
i;') compiled with no error. There exists atleast one defination of
'i'. what should we say to statement 'int i;' ?