By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,797 Members | 1,848 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,797 IT Pros & Developers. It's quick & easy.

void main() is user defind?

P: n/a
all the programer know the void main is user defind function so,change
the main is possible or not
and why? what can change the "main" word in the c? why?
please give the answer.....................

bye!!!!!!!!!!!!!!!!!!!!!!!!!

Sep 28 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
dhan wrote:
all the programer know the void main is user defind function so,change
the main is possible or not
and why? what can change the "main" word in the c? why?
please give the answer.....................
If you need to know about the C language, please follow the hallway
two doors down to comp.lang.c. If you didn't know that C and C++ are
two different languages, you might want to re-read the introduction
part to your textbook.

_In C++_, there is no "void main". In C++ 'main' function (and *all
programmers know that*) returns 'int'. That is required by the C++
language International Standard. Does that answer your question[s]?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Sep 28 '06 #2

P: n/a
dhan wrote:
all the programer know the void main is user defind function so,
void main is illegal in C++. main must always return int.
change the main is possible or not and why?
There are two different signatures for main that the standard covers. Those
are:

int main()

and

int main(int argc, char* argv[])

The compiler might support more variants, but they all must return int.
what can change the "main" word in the c? why?
Not sure what you mean by this.

Sep 28 '06 #3

P: n/a
Rolf Magnus wrote:
>>what can change the "main" word in the c? why?

Not sure what you mean by this.
I guess he means that you can change the name of the function that
serves as an executables entry point for some compilers. Furthermore
some compilers require a different signature for the executables entry
point (like WinMain under MS Windows). Since this is platform-specific
it is off-topic here.

Stuart
Sep 28 '06 #4

P: n/a
dhan wrote:
all the programer know the void main is user defind function so,change
the main is possible or not
and why? what can change the "main" word in the c? why?
please give the answer.....................

bye!!!!!!!!!!!!!!!!!!!!!!!!!
You can change "main" if you open the startup-code
with a hex-editor, search for "_main" and change the
string to "_mxxx" or whatever you want.

Or, if you have the assembler-source of the
starup-code, you can change it there.

But this is rather useless. No need to do it.

-Martin
Sep 29 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.