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

后端 未结 3 1320
佛祖请我去吃肉
佛祖请我去吃肉 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:24

    input is a pointer to a constant char, and you're assigning it to a pointer to a non-constant char. This here might be an interesting reading for you.

提交回复
热议问题