#include <stdio.h>
#include <stdlib.h>

typedef struct Node {
    int value;
    struct Node *next;
} Node;

int main(void)
{
    Node *head = malloc(sizeof(Node));
    Node *second = malloc(sizeof(Node));
    Node *third = malloc(sizeof(Node));

    head->value = 10;
    head->next = second;

    second->value = 20;
    second->next = third;

    third->value = 30;
    third->next = NULL;

    // Проходим по списку
    Node *current = head;

    while (current != NULL) {
        printf("%d\n", current->value);
        current = current->next;
    }

    // Освобождаем память
    free(third);
    free(second);
    free(head);

    return 0;
}

 
