これは単純なエラーかもしれませんが、まだエラーを理解できません。私は得ています
整数を出力するときの値の代わりにポインターアドレス。
#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);
}
fox.txt
The quick
brown fox
jumps over
the lazy
dog
出力:
There are 2665625 of words