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

'Papers > programming' 카테고리의 다른 글

struct pointer  (0) 2007.06.12
enum  (0) 2007.05.16
정수형 포인터 초기화  (0) 2007.02.28
소멸자를 가상함수로 쓰는 이유  (0) 2007.02.12
function pointer  (0) 2006.10.10