Swap two numbers (call by value) — NO effect outside Dry Run in C

Swap two numbers (call by value) — NO effect outside is an interactive C dry run visualizer from the Functions 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.

Swap two numbers (call by value) — NO effect outside Program Code

#include <stdio.h>

void swapByValue(int a, int b) {
    int temp = a;
    a = b;
    b = temp;
    printf("Inside function: a=%d, b=%d\n", a, b);
}

int main() {
    int x = 5, y = 10;
    printf("Before: x=%d, y=%d\n", x, y);
    swapByValue(x, y);
    printf("After: x=%d, y=%d (NO change)\n", x, y);
    return 0;
}

View the complete Functions programs page.

Program Console Swap two numbers (call by value) — NO effect outside Topic: C Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.