Click here to Skip to main content
15,898,939 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Quick Question on STL vector iterator Pin
Sebastian Schneider11-Jan-06 22:38
Sebastian Schneider11-Jan-06 22:38 
AnswerRe: Quick Question on STL vector iterator Pin
Stephen Hewitt11-Jan-06 22:55
Stephen Hewitt11-Jan-06 22:55 
QuestionUnexpected end of file while looking for precompiled header directive Pin
Sarvan AL11-Jan-06 21:54
Sarvan AL11-Jan-06 21:54 
AnswerRe: Unexpected end of file while looking for precompiled header directive Pin
Sebastian Schneider11-Jan-06 22:02
Sebastian Schneider11-Jan-06 22:02 
AnswerRe: Unexpected end of file while looking for precompiled header directive Pin
PJ Arends11-Jan-06 22:07
professionalPJ Arends11-Jan-06 22:07 
GeneralRe: Unexpected end of file while looking for precompiled header directive Pin
<color>Aljechin 11-Jan-06 22:51
<color>Aljechin 11-Jan-06 22:51 
GeneralRe: Global Variable in all the files Pin
Sarvan AL12-Jan-06 0:29
Sarvan AL12-Jan-06 0:29 
GeneralRe: Global Variable in all the files Pin
<color>Aljechin 12-Jan-06 0:49
<color>Aljechin 12-Jan-06 0:49 
GeneralRe: Global Variable in all the files Pin
<color>Aljechin 12-Jan-06 0:55
<color>Aljechin 12-Jan-06 0:55 
GeneralRe: Global Variable in all the files Pin
Blake Miller12-Jan-06 6:47
Blake Miller12-Jan-06 6:47 
GeneralRe: Global Variable in all the files Pin
<color>Aljechin 12-Jan-06 17:54
<color>Aljechin 12-Jan-06 17:54 
GeneralRe: Global Variable in all the files Pin
Blake Miller13-Jan-06 7:03
Blake Miller13-Jan-06 7:03 
GeneralThanks: Unexpected end of file while looking for precompiled header directive Pin
Sarvan AL12-Jan-06 0:36
Sarvan AL12-Jan-06 0:36 
QuestionCommunication Between EXEs Pin
rider cool11-Jan-06 21:48
rider cool11-Jan-06 21:48 
AnswerRe: Communication Between EXEs Pin
PJ Arends11-Jan-06 21:58
professionalPJ Arends11-Jan-06 21:58 
QuestionCreate Font to match Dialogue Box Pin
LittleYellowBird11-Jan-06 21:17
LittleYellowBird11-Jan-06 21:17 
AnswerRe: Create Font to match Dialogue Box Pin
Owner drawn11-Jan-06 21:51
Owner drawn11-Jan-06 21:51 
GeneralRe: Create Font to match Dialogue Box Pin
LittleYellowBird12-Jan-06 4:32
LittleYellowBird12-Jan-06 4:32 
QuestionFunction as argument Pin
kk.tvm11-Jan-06 20:35
kk.tvm11-Jan-06 20:35 
AnswerRe: Function as argument Pin
Owner drawn11-Jan-06 20:44
Owner drawn11-Jan-06 20:44 
AnswerRe: Function as argument Pin
Zdeslav Vojkovic11-Jan-06 20:47
Zdeslav Vojkovic11-Jan-06 20:47 
AnswerRe: Function as argument Pin
Cedric Moonen11-Jan-06 20:48
Cedric Moonen11-Jan-06 20:48 
You don't pass a function name as argument as another function but rather a pointer to a function:

First, you have to describe what is the 'type' of the function, for example:
typedef void (MyFunc*) (int,int);

This is a typedef that says that MyFunc is a type definition of a function returning nothing (the first void before (MyFunc*) ) and that takes two integer arguments (the argument list is specified after (MyFunc*) ).

Then, you can use MyFunc as a standard argument to a function:
void Do(MyFunc MyFuncThatWillBePassed)<br />
{<br />
}


This explain that the Do function will receive a pointer to a function of the type MyFunc as argument.

Inside your Do function, when you want to call your function, simply do that:
void Do(MyFunc MyFuncThatWillBePassed)<br />
{<br />
    int a=0,b=0;<br />
    MyFuncThatWillBePassed(a,b);<br />
}



Warning: you have to respect of course the type of the function and so you NEED to pass two integers (in our case) to your function otherwise you will have compile errors.

Hope this helps
GeneralRe: Function as argument Pin
Zdeslav Vojkovic11-Jan-06 21:06
Zdeslav Vojkovic11-Jan-06 21:06 
GeneralRe: Function as argument Pin
Cedric Moonen11-Jan-06 21:13
Cedric Moonen11-Jan-06 21:13 
GeneralRe: Function as argument Pin
kk.tvm11-Jan-06 20:56
kk.tvm11-Jan-06 20:56 

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.