Papers/programming

typedef, callback

tomato13 2007. 3. 17. 17:03

 

// test.h

#ifndef _TEST_H_
#define _TEST_H_

 

typedef  void CBF(void);

 

int watchIPConnection(CBF *cbFunction){
 cbFunction();

 return 1;
}

 

#endif // _TEST_H_

 

// test.cpp

#include
#include
#include "test.h"

 

void callback(void){
 printf("invoke: callback\n");
}

 

int main(void){
 watchIPConnection(&(callback));

 return true;
}

 

// result

invoke: callback

exec.txt
0.0MB