Nios/max args

From ASMBits

Write a function with a variable number of arguments that returns the maximum of all of its arguments. The first argument n tells you how many numbers to process. The remaining n signed integers are the numbers to proces. The function will be called with exactly n+1 arguments.

If n is 0 (no numbers to process), return 0. Otherwise, return the maximum of the n numbers.

int max (int n, ... );

Expected solution length: Around 20 lines.

Sample Input

max(2, 1, 2)

Sample Output

 2 

Write your solution here

Upload a source file...