문제

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>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top