如何将字符存储在C中的链接列表列表中

时间:2017-11-07 07:03:05

标签: c list linked-list

我正在尝试创建链接列表列表,但我收到警告:

warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=]
 printf("Data in 0 is : %s\n",list[0]->data);

代码在

之下
create(0,'A');
printf("Data in 0 is : %s\n",list[0]->data);

create()代码:

void create(int indx, char rsc){
    struct Node* tmp = (struct Node*)malloc(sizeof(struct Node));
    tmp->data = rsc;
    tmp->next = NULL;
    list[indx] = tmp;

节点列表初始化如下:

struct Node *list[26];

0 个答案:

没有答案