Ask your own question, for FREE!
Computer Science 7 Online
OpenStudy (anonymous):

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 .

OpenStudy (anonymous):

I don't get your question :( sorry http://ideone.com/1vKW8

OpenStudy (anonymous):

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"?

OpenStudy (anonymous):

Please don't just disappear, zatinmadaan. I'm really curious what's at play here.

OpenStudy (anonymous):

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.

OpenStudy (anonymous):

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.

OpenStudy (anonymous):

My question is why _main() is accepted as a variable name as the name of the variable cannot have special symbols except _(underscore).

OpenStudy (anonymous):

In C, you can prototype functions inside main. (but that doesn't mean that the function is scopred within main!)

OpenStudy (anonymous):

It's not a variable. Try assigning a value to it, like you can with variables

OpenStudy (anonymous):

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.

OpenStudy (anonymous):

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.

OpenStudy (anonymous):

what would the point be of a variable that you cannot give a value?

OpenStudy (anonymous):

ok , I m convinced. Thank you both agdgdgdgwngo and nczempin for your answer's and time.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!