+ 10
implicit declaration of global int variables with identical names in C
question to connoisseurs of the C compiler. I played around with the code (author of the AZTECCO code) in which there was an implicit declaration of an int variable, well, like this "i;" - and found this situation of the code that is being compiled and executed: j, k, k, l, m, l, g, n; f () {for (j = 8; j -;) printf ("% d% d", 9-j, j + 2);} int main () { f (); Â Â Â Â return 0; } my code (edition of AZTECCO code) https://code.sololearn.com/ciBOhR8Gm4Eo/?ref=app Of course, of interest is a group of global variables declared in an implicit way ... with duplicate names ... the compiler skips this. This is generally normal, maybe I'm not aware of what? AZTECCO code: https://code.sololearn.com/c4CKbw0lM3gh/?ref=app
4 Answers
+ 13
Michail Getmanskiy
It's just how C is worked in old days. In older versions of C this code can be fine as in C compiler if any declaration is not matched with inbuilt grammar of the language then it takes default int or pointers according to the use. In your code function is uses which by defaults return an integer value so it takes the default type for operations as int declaration. In past it's supposed to do for reducing the code length. This all things are checked at compile and linking time and due to assembly and low level language C support it well
In newer version of C the W-Implicit-Error should be come because of use of implicit function and variable declaration. But as sololearn compiler run on gcc and gnu so it's only parse an warning statement
Here is an related discussion link
https://stackoverflow.com/questions/9182763/implicit-function-declarations-in-c
Conpiler always looks for declaration of data type and tried to match with symbol table if not present their then type assign accordingly
+ 4
Michail Getmanskiy
The author of the code has described this "phenomenon" in answer within the code comments. I see you also wrote a comment in the code. I'm not sure whether there is anything more to discuss or confirm.
+ 4
Ipang I think Michail Getmanskiy asked about duplicated global names with the same name which is a specific interesting question in my opinion.
Coder Kitten answer should be â , it explains well and gives useful references
+ 4
AZTECCO
Okay I get it đ