This warnings appear:
f.c:14:16: warning: incompatible pointer to integer conversion assigning to 'char' from 'char [2]' [-Wint-conversion]
head1 -> data = "K";
^ ~~~
f.c:16:16: warning: incompatible pointer to integer conversion assigning to 'char' from 'char [2]' [-Wint-conversion]
head2 -> data = "a";
^ ~~~
This is the code:
#include <stdio.h>
#include <stdlib.h>
typedef struct _node {
char data;
struct _node *link;
}node;
int main (){
node *head1 = NULL;
node *head2 = NULL;
head1 = (node *)malloc (sizeof (node));
head2 = (node *)malloc (sizeof (node));
head1 -> data = "K";
head1 -> link = head2;
head2 -> data = "a";
printf("%c%c", head1->data, head2->data);
return 0;
}