Friday, 6 September 2013

Function Pointer in Struct

Function Pointer in Struct

How do you use Function Pointer in Struct? Specifically, given the
following example, the program compiles but crash on run-time:
In a header file
#ifndef __FUNCTION_IN_STRUCT_H_
#define __FUNCTION_IN_STRUCT_H_
struct functionDaemon {
int id;
//double (*funcp); // function pointer
double (*fp)(double); // Function pointer
};
// #define NULL 'V'

No comments:

Post a Comment