相关疑难解决方法(0)

传递参数1会丢弃指针目标类型的限定符

我的主要功能如下:

int main(int argc, char const *argv[])
{
    huffenc(argv[1]);
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

编译器返回警告:

huffenc.c:76: warning: passing argument 1 of ‘huffenc’ discards qualifiers from pointer target type

作为参考,huffenc接受char*输入,并执行该功能,样本输入"无意识"通过./huffenc senselessness

这警告意味着什么?

c program-entry-point argv

13
推荐指数
1
解决办法
3万
查看次数

在C中创建单链表

我正在尝试从输入文本文件创建单个链接列表以进行分配.我试图一次做一点,所以我知道我的代码不完整.我尝试创建头指针,然后打印出它的值,我甚至无法让它工作,但我不知道为什么.我包括了struct,我的创建列表和打印列表函数.我没有包含打开的文件,因为该部分有效.

typedef struct List
{
   struct List *next;   /* pointer to the next list node */
   char *str;           /* pointer to the string represented */
   int count;           /* # of occurrences of this string */
} LIST;

LIST *CreateList(FILE *fp) 
{
    char input[LINE_LEN];
    LIST *root;             /* contains root of list             */
    size_t strSize;         
    LIST *newList;          /* used to allocate new list members */

    while (fscanf(fp, BUFFMT"s", input) != EOF) {

        strSize = strlen(input) + 1;

        /* create root node if …
Run Code Online (Sandbox Code Playgroud)

c linked-list singly-linked-list

6
推荐指数
1
解决办法
5875
查看次数