Linked-style structure (basic pointer linking) Dry Run in C

Linked-style structure (basic pointer linking) is an interactive C dry run visualizer from the Struct Functions Pointers programs section. Study the source code, then use the execution controls to follow each step, variable update, highlighted line, and console output.

This page provides a browser-based dry run with source-code highlighting, auto-scroll, voice narration controls, and execution output for learning the program step by step.

Linked-style structure (basic pointer linking) Program Code

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

struct Node {
    int data;
    struct Node *next;  // Pointer to next node (self-referential)
};

int main() {
    // Create three nodes
    struct Node *head = NULL;
    struct Node *second = NULL;
    struct Node *third = NULL;
    
    // Allocate memory
    head = (struct Node*)malloc(sizeof(struct Node));
    second = (struct Node*)malloc(sizeof(struct Node));
    third = (struct Node*)malloc(sizeof(struct Node));
    
    // Assign data and link
    head->data = 10;
    head->next = second;  // Head points to second
    
    second->data = 20;
    second->next = third;  // Second points to third
    
    third->data = 30;
    third->next = NULL;    // Third points to NULL (end of list)
    
    // Traverse and display
    printf("Linked List: ");
    struct Node *current = head;
    while(current != NULL) {
        printf("%d ", current->data);
        current = current->next;
    }
    printf("\n");
    
    // Free memory
    free(head);
    free(second);
    free(third);
    
    return 0;
}

View the complete Struct Functions Pointers programs page.

Program Console Linked-style structure (basic pointer linking) Topic: C Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.