rendered paste body#include <stdio.h>
#include <stdlib.h>
struct client_s
{
int fd;
struct client_s *next;
} client_n;
int main()
{
int i;
struct client_s *ptr, *root;
ptr = root = calloc(1, sizeof(struct client_s));
for(i=0;i<=10;i++)
{
if(ptr->fd == NULL)
{
ptr->fd = i;
}
else
{
ptr = root;
while(ptr->next!=NULL)
{
ptr = ptr->next;
}
ptr->next = calloc(1, sizeof(struct client_s));
ptr = ptr->next;
ptr->fd = i;
}
}
ptr = root;
do
{
printf("%d\n", ptr->fd);
ptr = ptr->next;
}while(ptr!=NULL);
while(ptr!=NULL)
{
ptr = root;
root = root->next;
free(ptr);
}
}