I am trying to convert step's into code. I am specily stuck with function
Code:
#include<stdio.h>
#include<stdint.h>
#include<stdlib.h>
struct node
{
int data;
struct node * next;
};
struct node *add (struct node *head, struct node * tail, int value )
{
struct node * current = malloc(sizeof(*current));
if ( current != NULL )
{
current -> data = value;
current -> next = tail;
if( head == NULL )
{
head = current ;
}
else
{
tail = current ;
}
}
return current;
}
int main ()
{
struct node * head;
struct node * tail;
struct node * temp;
temp = add ( head, tail, 3 );
return 0;
}