C Linked List 4: Insert a new node at the beginning of a Singly Linked List [C Programming]

preview_player
Показать описание
Insert a new node at the beginning of a Singly Linked List.

Expected Output:
Input the number of nodes : 3
Input data for node 1 : 5
Input data for node 2 : 6
Input data for node 3 : 7

Data entered in the list are :
Data = 5
Data = 6
Data = 7

Input data to insert at the beginning of the list : 4

Data after inserted in the list are :
Data = 4
Data = 5
Data = 6
Data = 7

=================================================

Рекомендации по теме
Комментарии
Автор

thank you very muchh for this, i was stuck with how to write a function for inserting the node at the beginning but your video helped immensly, but i have a question if i wanted it to return smtg, do i write,

firstNode InsertAtBeginning(int Data);

you know if i don't want it to be a void??, and also what should it return??

nrx