代码: 全选
/*answer2.c*/
#include <stdio.h>
#include "msg.h"
int main()
{
printf("Where are you going to stay?\n");
msg1();
printf("How long are you going to stay?\n");
msg2();
return 0;
}
代码: 全选
/* msg1.c */
void msg1()
{
char *p="I am going to stay at my friend's home";
printf("%s\n",p);
}
代码: 全选
/* msg2.c */
void msg2()
{
char *p="For ten days.";
printf("%s\n",p);
}
代码: 全选
/* msg.h */
void msg1();
void msg2();
代码: 全选
andy@ubuntu:~/c$ gcc answer2.c msg1.c msg2.c -o answer2
msg1.c: 在函数 ‘msg1’ 中:
msg1.c:5: 警告: 隐式声明与内建函数 ‘printf’ 不兼容
msg2.c: 在函数 ‘msg2’ 中:
msg2.c:5: 警告: 隐式声明与内建函数 ‘printf’ 不兼容