Pointer size vs data size Dry Run in C

Pointer size vs data size is an interactive C dry run visualizer from the Pointersintro 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 size vs data size Program Code

#include <stdio.h>
int main() {
    int i = 42;
    int *ptr = &i;
    
    printf("Size of data (int): %lu bytes\n", sizeof(i));
    printf("Size of pointer (int*): %lu bytes\n", sizeof(ptr));
    printf("Size of pointer (void*): %lu bytes\n", sizeof(void*));
    
    // Compare sizes for different types
    printf("\nData type sizes:\n");
    printf("char: %lu byte\n", sizeof(char));
    printf("short: %lu bytes\n", sizeof(short));
    printf("int: %lu bytes\n", sizeof(int));
    printf("long: %lu bytes\n", sizeof(long));
    printf("float: %lu bytes\n", sizeof(float));
    printf("double: %lu bytes\n", sizeof(double));
    
    printf("\nPointer sizes (all same):\n");
    printf("char*: %lu bytes\n", sizeof(char*));
    printf("int*: %lu bytes\n", sizeof(int*));
    printf("double*: %lu bytes\n", sizeof(double*));
    
    return 0;
}

View the complete Pointersintro programs page.

Program Console Pointer size vs data size Topic: C Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.