“assignment discards 'const' qualifier” error on non-const pointer

后端 未结 3 1318
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-19 01:47

In the following function:

char *mystrtok(const char *input, const char *delim,char *rest) {
    int i;
    for (i = 0; input[i] != *delim && input[i         


        
3条回答
  •  花落未央
    2021-01-19 02:16

    change the prototype to

    char *mystrtok(const char *input, const char *delim, const char *rest);
    

提交回复
热议问题