+ 1
C problem
In c language, if we declare and initialise main as a variable, shouldn't it produce a compile time error? int main=3; (It will print 3 ) why? Can anyone explain?
4 Answers
+ 3
But main is inbuilt function, i thought we can't use it as a variable nameš¤
+ 2
`main()` is not a inbuilt function. It's a user defined function.
> In c language, if we declare and initialise main as a variable, shouldn't it produce a compile time error?
No. `main` is not a keyword. It's a valid identifier. Declarating a variable `main` at function scope or block scope won't generate error.
If you declare `main` variable at file scope it'll generate error.
+ 2
Main() is not a user defined function, its a predefined function
+ 1
Ok...thanks