Click here to Skip to main content
15,894,539 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralOdd Question Pin
Nick Parker6-Jan-03 17:39
protectorNick Parker6-Jan-03 17:39 
GeneralRe: Odd Question Pin
Abbas_Riazi6-Jan-03 20:36
professionalAbbas_Riazi6-Jan-03 20:36 
GeneralMenu Bar Pin
pranavamhari6-Jan-03 14:29
pranavamhari6-Jan-03 14:29 
GeneralRe: Menu Bar Pin
xxhimanshu6-Jan-03 17:54
xxhimanshu6-Jan-03 17:54 
GeneralFrom CWnd to CFrameWnd: menu items appear disabled! Pin
Mr.Freeze6-Jan-03 13:43
Mr.Freeze6-Jan-03 13:43 
GeneralWorking now, but don't know why! Pin
Mr.Freeze6-Jan-03 17:44
Mr.Freeze6-Jan-03 17:44 
GeneralRe: From CWnd to CFrameWnd: menu items appear disabled! Pin
Michael Dunn6-Jan-03 21:24
sitebuilderMichael Dunn6-Jan-03 21:24 
QuestionFunction Pointer? Pin
Aidman6-Jan-03 11:16
Aidman6-Jan-03 11:16 
Hi all, Smile | :)

Is it possible to declare a function pointer outside function arguments? I mean like declaring a pointer as a separate variable which isn’t an argument and can change the function it is pointing at, assuming that whatever function it points at always has the same arguments. Like this code for example. Please note that I know this following code doesn’t compile, I just want to explain my question in code, it’s always a lot easier.

<br />
void realfunc(void){ // declaring a normal function with no arguments<br />
      return;<br />
}<br />
<br />
int main(){<br />
      void (*funcptr)(void); // declaring "function pointer" with no arguments<br />
      *funcptr=realfunc; // "function pointer" pointing at a normal function with same argument settings<br />
      funcptr(); // calling the function that the "function pointer" is pointing at<br />
      return 0;<br />
}<br />


So is there something similar to this code? In other words is it possible to do something like this? Confused | :confused:


Aidman » over and out
AnswerRe: Function Pointer? Pin
Stefan Pedersen6-Jan-03 11:35
Stefan Pedersen6-Jan-03 11:35 
AnswerRe: Function Pointer? Pin
Chris Richardson6-Jan-03 11:38
Chris Richardson6-Jan-03 11:38 
GeneralAdvanced Function Pointer? Pin
Aidman6-Jan-03 13:02
Aidman6-Jan-03 13:02 
GeneralRe: Advanced Function Pointer? Pin
valikac6-Jan-03 14:13
valikac6-Jan-03 14:13 
GeneralRe: Advanced Function Pointer? Pin
Aidman6-Jan-03 21:37
Aidman6-Jan-03 21:37 
GeneralRe: Advanced Function Pointer? Pin
Stefan Pedersen7-Jan-03 1:55
Stefan Pedersen7-Jan-03 1:55 
GeneralRe: Advanced Function Pointer? Pin
Aidman7-Jan-03 3:28
Aidman7-Jan-03 3:28 
GeneralRe: Advanced Function Pointer? Pin
Stefan Pedersen7-Jan-03 3:34
Stefan Pedersen7-Jan-03 3:34 
GeneralRe: Advanced Function Pointer? Pin
Todd Smith7-Jan-03 5:46
Todd Smith7-Jan-03 5:46 
GeneralRe: Advanced Function Pointer? Pin
Aidman7-Jan-03 6:37
Aidman7-Jan-03 6:37 
GeneralRe: Advanced Function Pointer? Pin
Chris Richardson7-Jan-03 7:38
Chris Richardson7-Jan-03 7:38 
GeneralRe: Advanced Function Pointer? Pin
Aidman7-Jan-03 10:50
Aidman7-Jan-03 10:50 
GeneralFunction Pointers in OOP Pin
tilli again6-Jan-03 11:11
susstilli again6-Jan-03 11:11 
GeneralRe: Function Pointers in OOP Pin
Alvaro Mendez6-Jan-03 11:38
Alvaro Mendez6-Jan-03 11:38 
GeneralRe: Function Pointers in OOP Pin
William E. Kempf6-Jan-03 12:03
William E. Kempf6-Jan-03 12:03 
GeneralRe: Function Pointers in OOP Pin
valikac6-Jan-03 16:07
valikac6-Jan-03 16:07 
GeneralRe: Function Pointers in OOP Pin
tilli again7-Jan-03 8:43
susstilli again7-Jan-03 8:43 

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.