Run ❯
Get your
own
website
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Go to Spaces
Ctrl+Alt+P
#include
struct Node { int data; struct Node *next; }; int main() { // Create three nodes struct Node a, b, c; a.data = 10; b.data = 20; c.data = 30; // Link them together a.next = &b; b.next = &c; c.next = NULL; // The last node points to NULL // Walk through the list and print each value struct Node *current = &a; while (current != NULL) { printf("%d -> ", current->data); current = current->next; } printf("NULL\n"); return 0; }
10 -> 20 -> 30 -> NULL