Posts

Showing posts from April, 2020

creation of first node in linked list

Image
A  linked list  is a set of dynamically allocated nodes, arranged in such a way that each node contains one value and one pointer. The pointer always points to the next member of the  list . If the pointer is NULL, then it is the last node in the  list . ... If that pointer is also NULL, then the  list  is considered to be empty. paste it and run this code.. //CREATING A NODE Against LinkedList IN C #include #include #include #include //defining a datatype struct node //'struct' is keyword and 'node' is a tag { int data; struct node *next; }; struct node *head=0; int main() { int *newnode; newnode=(struct node*)malloc(sizeof(struct node));//malloc returns a void pointer so we have to pointer cast printf("enter the data");//asking of data scanf("%d",&newnode->data);//pasting the element at data part newnode->next=0; head=newnode; } if any further assistance required then please do co