C语言问题,代码如下
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(int argc, char *argv){
FILE *fp;
fp = fopen(argv[1], "r");
int delimiter = 0001; //不需要
int number = 0010; //不需要
int inputLength; //length
int symbol = 0100; //不需要
int error = 1000; //不需要
//int digital_length; //不需要
char *input;
int remain;
int length = 0;
fscanf(fp,"%s\n",input); //read all inputs, store in input
inputLength = getLength(input);
printf("%d\n", inputLength);
}
可以通过‘gcc first.c -lm -o first’来生成文件,
但是当我通过 ./first 10000 来测试文件时,出现segmentation fault的错误。
我想问一下是哪里出现问题,怎么修改?