This is my code
#include<stdio.h>
#include<stdlib.h>
void main() {
FILE *fp;
char * word;
char line[255];
fp=fopen("input.txt","r");
while(fgets(line,255,fp)){
word=strtok(line," ");
while(word){
printf("%s",word);
word=strtok(NULL," ");
}
}
}
This the warning I get.
token.c:10:7: warning: assignment makes pointer from integer without a cast [enabled by default]
word=strtok(line," ");
^
token.c:13:8: warning: assignment makes pointer from integer without a cast [enabled by default]
word=strtok(NULL," ");
^
The word
is declared as char*
. Then why this warning arises?
#include <string.h>
– Paraclete