|
|
发表于 2006-8-11 20:12:40
|
显示全部楼层
- #include <stdio.h>
- typedef void (*pDesc)(void);
- typedef void (*pFee)(long);
- void Desc()
- {
- printf("Address: %s\n", "I come from BTW");
- }
- void Fee(long pLong)
- {
- printf("Fee: %ld\n",pLong);
- }
- void Dothing(char* pName, pDesc desc, pFee fee, int pScore)
- {
- printf("%s\n", pName);
- desc();
- fee(100);
- printf("%d\n", pScore);
- }
- int main()
- {
- pDesc pDescstu1;
- pFee pFeestu1;
- pDescstu1 = Desc;
- pFeestu1 = Fee;
- Dothing("Ascort", Desc, Fee, 60);
- return 0;
- }
复制代码- rf@RemoteFish:/dev/shm$ gcc a.c
- rf@RemoteFish:/dev/shm$ ./a.out
- Ascort
- Address: I come from BTW
- Fee: 100
- 60
复制代码 |
|