C语言填空题头文件

来源:百度知道 编辑:UC知道 时间:2024/04/28 01:43:23
/*a.h*/
__[1]__
__[2]__
main()
{printf("\n");
try_me();
printf("\n");
}
try_me()
{char c;
if((c=getchar())!='n')
{putchar(c);
try_me();
}
}
请讲解一下。

1 #include "stdio.h"
你程序里调用了C输入输出库函数,因此要include输入输出库函数所在的头文件,文件编译时才能找到输入输出库函数。
2 void try_me();
函数调用之前都要定义,如果在MAIN函数调用之前就已经定义好了就不需要,而在之后就要在MAIN函数之前定义。如果你改成
#include "stdio.h"
try_me()
{char c;
if((c=getchar())!='n')
{putchar(c);
try_me();
}
main()
{printf("\n");
try_me();
printf("\n");
}
这样也可以,MAIN函数之前就不要再定义了。

#include<stdio.h>
#include<myfile.h>
其中myfile.h是自己定义的包含try_me的头文件

1 #include "stdio.h" 包含头文件,要使用库函数
2 void try_me(); 函数说明,因为函数定义在主函数之后

e