C Programming

Practise Exercise 8: Functions

JavaScript compatible inter-active version of this test.

1. Write a function called menu which prints the text string "Menu choices". The function does not pass any data back, and does not accept any data as parameters.

2. Write a function prototype for the above function.

3. Write a function called print which prints a text string passed to it as a parameter (ie, a character based array).

4. Write a function prototype for the above function print.

5. Write a function called total, which totals the sum of an integer array passed to it (as the first parameter) and returns the total of all the elements as an integer. Let the second parameter to the function be an integer which contains the number of elements of the array.

6. Write a function prototype for the above function.

Answers


ęCopyright B Brown. 1984-1999. All rights reserved.