Pointr to function

  • Thread starter Rafal 'Raf256' Maj
  • Start date
R

Rafal 'Raf256' Maj

Hi,
how can I make variable 'ptr' - an pointer to function taking parameter
'int' and returning 'float' ?

How can I define 'tPtr' to by type as above?
 
E

E. Robert Tisdale

Rafal said:
how can I make variable 'ptr' - an pointer to function taking parameter
'int' and returning 'float' ?

How can I define 'tPtr' to by type as above?


typedef float function_t(int);
float f(int);
function_t ptr = f;
 
R

Rob Williscroft

Jack Klein wrote in
Wrong, the typedef above does not establish any kind of pointer.

typedef float (function_t*)(int);

You mean:

typedef float (*function_t)( int );

Rob.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,413
Latest member
ReeceDorri

Latest Threads

Top