Find largest element in array using function Dry Run in C

Find largest element in array using function 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.

Find largest element in array using function Program Code

#include <stdio.h>

int findMax(int arr[], int size) {
    int max = arr[0];
    for(int i = 1; i < size; i++) {
        if(arr[i] > max) {
            max = arr[i];
        }
    }
    return max;
}

int main() {
    int nums[] = {45, 23, 89, 12, 67, 34, 91};
    int n = sizeof(nums) / sizeof(nums[0]);
    int maximum = findMax(nums, n);
    printf("Largest element = %d\n", maximum);
    return 0;
}

View the complete Functions programs page.

Program Console Find largest element in array using function Topic: C Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.