全部博文(436)
分类: C/C++
2013-09-14 23:14:25
/* greeting.h */ #ifndef _GREETING_H #define _GREETING_H void greeting(char *name); #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif #endif /* _GREETING_H */ |
/* greeting.c */ #include #include "greeting.h" void greeting (char * name) { printf("Hello %s!\r\n",name); } |
/* goodbye.h */ #ifndef _GOODBYE_H #define _GOODBYE_H void goodbye(void); #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif #endif /* _GOODBYE_H */ |
/* goodbye.c */ #include #include "goodbye.h" void goodbye(void) { printf("Hope to see you again!\n"); } |
/* my_app.c */ #include int main(void) { char name[10]; printf("Your Name,Please:"); scanf("%s",name); greeting(name); goodbye(); return 0; } |