#include <stdio.h>
#include <stdlib.h>
typedef struct node{
char *name;
struct node *next;
} node;
void addNode(node **start, char *str)
{
node *newNode = malloc(sizeof(node));
newNode -> name = str;
newNode-> next = NULL;
if (*start == NULL)
{
*start = newNode;
} else {
node *current = *start;
while (current -> next != NULL)
{
current = current -> next;
}
current -> next = newNode;
}
}
int main() {
node *head = NULL;
char *str;
scanf("%s", str);
addNode(&head, str);
addNode(&head, "abouqassime");
while (head != NULL)
{
printf("%s ", head->name);
head = head-> next;
}
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: