Please refer the program shown below. I get the following compiler warnings.
bash-3.2$ gcc -Wall test1.c test1.c:6: warning: data definition has no type or storage class test1.c:6: warning: type defaults to ‘int’ in declaration of ‘j’
Usually this warning is thrown when runtime operation is written outside the function. So I am questioning why in a global scope, "int j; j=20" throws warning but "int i = 10" does not?
#include <stdio.h>
int i = 10;
int j;
j=20;
int
main(void)
{
int k;
k = 30;
printf("%d %d %d\n", i, j, k);
return 0;
}