Click here to Skip to main content
16,012,082 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Notification on Hibernate? Pin
Dominik Reichl20-Jan-08 0:25
Dominik Reichl20-Jan-08 0:25 
QuestionHow can capture video from video-capture-card Pin
hanlei000000000919-Jan-08 3:51
hanlei000000000919-Jan-08 3:51 
AnswerRe: How can capture video from video-capture-card Pin
Mark Salsbery19-Jan-08 7:09
Mark Salsbery19-Jan-08 7:09 
GeneralThanks, I choose DirectShow Pin
hanlei000000000919-Jan-08 22:44
hanlei000000000919-Jan-08 22:44 
Generalwhy the code can compile -- about function pointer Pin
George_George19-Jan-08 2:55
George_George19-Jan-08 2:55 
GeneralRe: why the code can compile -- about function pointer Pin
CPallini19-Jan-08 3:17
mveCPallini19-Jan-08 3:17 
GeneralRe: why the code can compile -- about function pointer Pin
George_George19-Jan-08 21:04
George_George19-Jan-08 21:04 
GeneralRe: why the code can compile -- about function pointer Pin
CPallini20-Jan-08 0:11
mveCPallini20-Jan-08 0:11 
George_George wrote:
void (**p)();

int main()
{
p = new (void (*[3])());
return 0;
}


void (**p)();

declares a pointer to a pointer to a function accepting no arguments and returning no arguments.

new (void (*[3])());

allocates memory for an array of pointers to functions accepting no argument and returning no value.
p can be initialised with the address of the first element of the array, i.e. with the (implicit) array name.

For instance, try the following:
void fun1() { printf("Hi");}
void fun2() { printf(" George");}

void (**p)();

int main()
{
p = new (void (*[3])());
p[0] = fun1;
p[1] = fun2;
p[2] = fun2;

p[0]();
p[1]();
p[2]();

}



Smile | :)

If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

[my articles]


GeneralRe: why the code can compile -- about function pointer Pin
George_George20-Jan-08 0:22
George_George20-Jan-08 0:22 
GeneralStructured exception Pin
George_George19-Jan-08 2:47
George_George19-Jan-08 2:47 
GeneralRe: Structured exception Pin
Hamid_RT19-Jan-08 19:11
Hamid_RT19-Jan-08 19:11 
GeneralRe: Structured exception Pin
George_George19-Jan-08 22:04
George_George19-Jan-08 22:04 
Generalif IDCANCEL returned in DOMODAL. Pin
Le@rner19-Jan-08 1:02
Le@rner19-Jan-08 1:02 
QuestionRe: if IDCANCEL returned in DOMODAL. Pin
CPallini19-Jan-08 1:52
mveCPallini19-Jan-08 1:52 
QuestionRe: if IDCANCEL returned in DOMODAL. Pin
Rajesh R Subramanian19-Jan-08 2:30
professionalRajesh R Subramanian19-Jan-08 2:30 
QuestionRe: if IDCANCEL returned in DOMODAL. Pin
David Crow19-Jan-08 11:48
David Crow19-Jan-08 11:48 
GeneralRe: if IDCANCEL returned in DOMODAL. Pin
Paul Conrad19-Jan-08 11:53
professionalPaul Conrad19-Jan-08 11:53 
GeneralRe: if IDCANCEL returned in DOMODAL. Pin
Hamid_RT19-Jan-08 19:03
Hamid_RT19-Jan-08 19:03 
Generalsetw issue Pin
gentleguy19-Jan-08 0:48
gentleguy19-Jan-08 0:48 
GeneralRe: setw issue Pin
Don Box19-Jan-08 1:00
Don Box19-Jan-08 1:00 
GeneralRe: setw issue Pin
gentleguy19-Jan-08 1:23
gentleguy19-Jan-08 1:23 
GeneralRe: setw issue Pin
CPallini19-Jan-08 4:37
mveCPallini19-Jan-08 4:37 
GeneralRe: setw issue Pin
gentleguy20-Jan-08 1:11
gentleguy20-Jan-08 1:11 
GeneralInclude guards vs. pragma Pin
73Zeppelin18-Jan-08 19:58
73Zeppelin18-Jan-08 19:58 
GeneralRe: Include guards vs. pragma Pin
CPallini18-Jan-08 21:32
mveCPallini18-Jan-08 21:32 

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.