Menu
Coddy logo textTech

Maximum Number

Lesson 16 of 17 in Coddy's Functions in C course.

challenge icon

Challenge

Easy

Function to find the maximum number in an array. For example, if the array of numbers is [23, 45, 67, 88], the output should be 88.

Try it yourself

#include <stdio.h>

void findMax(int count, int numbers[]) {
    
}

int main() {
    // Don't Change this!
    int numbers[] = {3, 7, 20, 9, 5};
    // Here we Calculates the number of elements in the array using sizeof
    int count = sizeof(numbers) / sizeof(numbers[0]);
    // Call the function
    findMax(count, numbers);
    
    return 0;
}

All lessons in Functions in C