0

Can't loop through Linked list in C

Have created a linked list for a number (int number;) and pointer for another node (struct node *next) and assigned first node number to 1 & second nide number to 2 . Obviously did manually. And if loop through it print values of int number in each node (aka those 2 node) I get the first node number 2 times??? Using both while and for loop....

13th Dec 2022, 2:16 AM
Ateeq Aslam
Ateeq Aslam - avatar
3 Respuestas
+ 5
Ok good job! just a bit of note, you probably wanna make a function to add node(s) instead of repeating the commands to do it in main(). Modularity helps in debugging and prevent main() to overgrow : )
13th Dec 2022, 6:07 AM
Ipang
+ 3
Don't forget to attach the code bit link in post Description, need to check it first to know what's wrong, and what to do to fix.
13th Dec 2022, 3:54 AM
Ipang
+ 1
Fine will do it thanks
13th Dec 2022, 7:44 AM
Ateeq Aslam
Ateeq Aslam - avatar