I have a problem in c programming that variable name can only include alphabets, digits and underscore but if i write "int _main() then it is accepted as a variable name .
Are you saying that the brackets are interpreted to be part of the variable "_main" instead of defining the function "_main"? That would surprise me very much, and would indicate a compiler that is not compliant with the C programming language. Can you show us a code snippet and tell us what leads you to the conclusion "is accepted as a variable name"?
Please don't just disappear, zatinmadaan. I'm really curious what's at play here.
No it won't in C and C++ and python and Java and D and B.I don't know any language where it does.
here is the code along with the screenshot of the output where it is accepted as a variable ie no error . Hope this would be helpful.
My question is why _main() is accepted as a variable name as the name of the variable cannot have special symbols except _(underscore).
In C, you can prototype functions inside main. (but that doesn't mean that the function is scopred within main!)
It's not a variable. Try assigning a value to it, like you can with variables
so what is it ?. int _main() means that it is a variable but i think it might be some special kind of variable which can only be declared not initialized.
no it is not a variable, why do you keep insisting on that? The only one saying it is a variable is you. agdgdgdgwngo already told you what it is.
what would the point be of a variable that you cannot give a value?
ok , I m convinced. Thank you both agdgdgdgwngo and nczempin for your answer's and time.
Join our real-time social learning platform and learn together with your friends!