You need the proper include:
#include <string.h>
質問
here is the code:
#include <stdio.h>
int main(){
char asd[10];
gets(asd);
printf("\nEnter => ");
scanf("%[^\n]s",asd);
char *token;
char delim[5] = " ";
token = strtok(asd, delim);
int total = 0;
while(token != NULL){
printf( " %s \n", token);
int val = atoi(token);
total = total + val;
token = strtok(NULL, delim);
}
printf("total = %d", total);
return 0;
}
[Warning] assignment makes pointer from integer without a cast[enebled by default]
I think it was working with another Dev C++. Is it because of a difference in the version of Dev C++? How can I fix it?
解決
You need the proper include:
#include <string.h>