I do not understand working of function in the given code. This is a sample function that will be in the linked list. I know only function take data and return pointer
Is it a useful function that adds a new node in the list?
Is it a useful function that adds a new node in the list?
Code:
#include<stdio.h>
#include<stdlib.h>
struct Node{
int data;
struct Node *next;
};
struct Node * New_Node( int data){
struct Node *p = malloc(sizeof(*p));
p->data = data;
p->next = NULL;
return p;
}
int main ()
{
struct Node * pS1;
struct Node * pS2;
pS1 = newNode(100);
pS2 = newNode(456);
return 0;
}