1
이 코드를 실행하면 세그먼트 오류가 발생합니다.strtok가 int 형식의 코드를 반환합니다
main()
{
char *line ="2,3,22";
int size=3,i,j;
double value;
char *val;
for (i = 0; i<size ; i++) {
if (line == NULL) break;
printf("%s\n",strtok (line ,","));
}
}
와 내가 *는 char strtok
값을 할당 할 때
"warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=] printf("%s\n",strtok (line ,","));"
그래서이 오류를 준했다. 왜 strtok
int 값을 반환합니까? 해결 방안은 무엇인가?