Question

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?

Was it helpful?

Solution

You need the proper include:

#include <string.h>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top