我正在阅读 C 教程,它在 #include
之后缺少一些内容:
/*** reads in n integers from a file,
then prints the values to another file as type float ***/
#include /*** for file manipulation functions ***/
#include /*** for malloc() ***/
main()
{
int i, n, *x;
char file_name[FILENAME_MAX];
FILE *fp;
printf("file name for input: "); scanf("%s", file_name);
fp = fopen(file_name, "r");
if (fp == NULL)
{
printf("error: could not open file %s\n", file_name);
exit(-1);
}
fscanf(fp, "%d", &n);
x = (int *) malloc(n * sizeof(int));
缺少什么?
最佳答案
#include <stdio.h> // for file manipulation
#include <stdlib.h> // for malloc()
这很容易通过谷歌搜索。
关于c - 这里缺少哪些头文件(C 代码)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9218237/