我知道这可能是一个简单的错误,但我仍然无法找出错误。我正进入(状态
当我打印出一个整数时,指针地址而不是值。
#include<stdio.h>
int main(){
char s1[100];
int words,lines,chara = 0;
FILE * fp;
fp = fopen("fox.txt","r");
if(fp==NULL){
printf("Can't open file");
}
else{
while (fscanf(fp,"%s",s1) != EOF){
words++;
// printf("%s",s1);
}
}
printf("There are %d of words",words);
}
狐狸.txt
The quick
brown fox
jumps over
the lazy
dog
输出 :
There are 2665625 of words