相关疑难解决方法(0)

初始化会丢弃指针目标类型的限定符

我正在尝试打印链接文本中提到的单链表的列表.它工作,但我得到编译器警告:

Initialization discards qualifiers from pointer target type

(关于start = head的声明)和

return discards qualifiers from pointer target type

(在返回语句中)在此代码中:

/* Prints singly linked list and returns head pointer */
LIST *PrintList(const LIST *head) 
{
    LIST *start = head;

    for (; start != NULL; start = start->next)
        printf("%15s %d ea\n", head->str, head->count);

    return head;
}
Run Code Online (Sandbox Code Playgroud)

我正在使用XCode.有什么想法吗?

c linked-list

35
推荐指数
2
解决办法
8万
查看次数

标签 统计

c ×1

linked-list ×1