Skip to content

Latest commit

 

History

History

Functions in C

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Objective
In this challenge, you will learn simple usage of functions in C. Functions are a bunch of statements grouped together. A function is provided with zero or more arguments, and it executes the statements on it. Based on the return type, it either returns nothing (void) or something.

A sample syntax for a function is
return_type function_name(arg_type_1 arg_1, arg_type_2 arg_2, ...) { ... ... ... [if return_type is non void] return something of type return_type; }




Write a function int max_of_four(int a, int b, int c, int d) which reads four arguments and returns the greatest of them.

There is not built in max function in C. Code that will be reused is often put in a separate function, e.g. int max(x, y) that returns the greater of the two values.

Sample Input 0

Sample Output 0