0

I am trying to create a list of linked lists, but i get a warning:

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);

the code is below

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

the create() code:

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

the list of Nodes is initialized as follows:

struct Node *list[26];

0 Answers0