Click here to Skip to main content
15,902,938 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: calling of function ? Pin
Stefan_Lang5-Aug-14 22:37
Stefan_Lang5-Aug-14 22:37 
AnswerRe: calling of function ? Pin
Satya Chamakuri13-Aug-14 20:34
Satya Chamakuri13-Aug-14 20:34 
GeneralRe: calling of function ? Pin
mybm119-Aug-14 18:13
mybm119-Aug-14 18:13 
QuestionWhich IDE is good for programming in C Pin
SHUVO BISWAS2-Aug-14 21:40
SHUVO BISWAS2-Aug-14 21:40 
AnswerRe: Which IDE is good for programming in C Pin
CPallini3-Aug-14 0:14
mveCPallini3-Aug-14 0:14 
AnswerRe: Which IDE is good for programming in C Pin
«_Superman_»3-Aug-14 3:31
professional«_Superman_»3-Aug-14 3:31 
Questionhow do i make another main.c file where i can call this program and run according to it..? Pin
mybm11-Aug-14 20:31
mybm11-Aug-14 20:31 
AnswerRe: how do i make another main.c file where i can call this program and run according to it..? Pin
Richard MacCutchan1-Aug-14 21:01
mveRichard MacCutchan1-Aug-14 21:01 
GeneralRe: how do i make another main.c file where i can call this program and run according to it..? Pin
mybm11-Aug-14 21:09
mybm11-Aug-14 21:09 
GeneralRe: how do i make another main.c file where i can call this program and run according to it..? Pin
Richard MacCutchan1-Aug-14 21:45
mveRichard MacCutchan1-Aug-14 21:45 
GeneralRe: how do i make another main.c file where i can call this program and run according to it..? Pin
mybm11-Aug-14 23:34
mybm11-Aug-14 23:34 
GeneralRe: how do i make another main.c file where i can call this program and run according to it..? Pin
Richard MacCutchan2-Aug-14 0:41
mveRichard MacCutchan2-Aug-14 0:41 
GeneralRe: how do i make another main.c file where i can call this program and run according to it..? Pin
mybm12-Aug-14 2:06
mybm12-Aug-14 2:06 
GeneralRe: how do i make another main.c file where i can call this program and run according to it..? Pin
Richard MacCutchan2-Aug-14 2:49
mveRichard MacCutchan2-Aug-14 2:49 
GeneralRe: how do i make another main.c file where i can call this program and run according to it..? Pin
CPallini2-Aug-14 2:59
mveCPallini2-Aug-14 2:59 
GeneralRe: how do i make another main.c file where i can call this program and run according to it..? Pin
Richard MacCutchan2-Aug-14 3:05
mveRichard MacCutchan2-Aug-14 3:05 
AnswerRe: Put the other main in a namespace Pin
Software_Developer2-Aug-14 7:10
Software_Developer2-Aug-14 7:10 
In C++, you can only have one main.


The standard explicitly says in 3.6.1:

A program shall contain a global function called main,
hich is the designated start of the program.

[...] This function shall not be overloaded.


You can have two functions called main. The name is not special in any way and it's not reserved.
What's special is the function, and it happens to have that name. The function is global.
So if you write a main function in some other namespace, you will have a second main function.
C++
namespace secondMain
{
  int main() { return 0; } 
}

int main() 
{ 
   secondMain::main(); 

}

The first main function is not special - notice how you have to return explicitly.
GeneralRe: Put the other main in a namespace Pin
CPallini3-Aug-14 0:20
mveCPallini3-Aug-14 0:20 
QuestionC++ ofstream System.AccessViolation Pin
Kit Fisto1-Aug-14 5:07
Kit Fisto1-Aug-14 5:07 
QuestionRe: C++ ofstream System.AccessViolation Pin
CPallini1-Aug-14 6:11
mveCPallini1-Aug-14 6:11 
AnswerRe: C++ ofstream System.AccessViolation Pin
Kit Fisto1-Aug-14 6:22
Kit Fisto1-Aug-14 6:22 
GeneralRe: C++ ofstream System.AccessViolation Pin
CPallini1-Aug-14 22:05
mveCPallini1-Aug-14 22:05 
AnswerRe: C++ ofstream System.AccessViolation Pin
Kit Fisto4-Aug-14 23:49
Kit Fisto4-Aug-14 23:49 
AnswerRe: C++ ofstream System.AccessViolation Pin
Member 138550171-Jun-18 13:43
Member 138550171-Jun-18 13:43 
QuestionHow can I display Japanese characters in an application ? Pin
Swap930-Jul-14 23:12
Swap930-Jul-14 23:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.