Pointer to array of structures Dry Run in C

Pointer to array of structures 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.

Pointer to array of structures Program Code

#include <stdio.h>

struct Movie {
    char title[50];
    int year;
    float rating;
};

int main() {
    struct Movie movies[3] = {
        {"Inception", 2010, 8.8},
        {"Interstellar", 2014, 8.6},
        {"The Dark Knight", 2008, 9.0}
    };
    
    struct Movie *ptr = movies;  // Points to first movie
    
    printf("Using pointer to access array:\n");
    for(int i = 0; i < 3; i++) {
        printf("Movie %d: %s (%d) - Rating: %.1f\n", 
               i+1, (ptr+i)->title, (ptr+i)->year, (ptr+i)->rating);
    }
    
    printf("\nUsing array indexing:\n");
    for(int i = 0; i < 3; i++) {
        printf("Movie %d: %s (%d) - Rating: %.1f\n", 
               i+1, movies[i].title, movies[i].year, movies[i].rating);
    }
    
    return 0;
}

View the complete Struct Functions Pointers programs page.

Program Console Pointer to array of structures Topic: C Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.