Access structure using pointer (-> operator) Dry Run in C

Access structure using pointer (-> operator) 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.

Access structure using pointer (-> operator) Program Code

#include <stdio.h>

struct Car {
    char model[50];
    int year;
    float price;
};

int main() {
    struct Car myCar = {"Tesla Model 3", 2023, 45000.00};
    struct Car *ptr = &myCar;
    
    // Access using pointer - arrow operator
    printf("Using Arrow Operator (->):\n");
    printf("Model: %s\n", ptr->model);
    printf("Year: %d\n", ptr->year);
    printf("Price: $%.2f\n", ptr->price);
    
    // Access using dereference and dot
    printf("\nUsing (*ptr). notation:\n");
    printf("Model: %s\n", (*ptr).model);
    printf("Year: %d\n", (*ptr).year);
    printf("Price: $%.2f\n", (*ptr).price);
    
    return 0;
}

View the complete Struct Functions Pointers programs page.

Program Console Access structure using pointer (-> operator) Topic: C Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.