This browser does not support JavaScript. In order to use this test, please update your browser to a JavaScript compatible browser, or choose the CGI version of this test. Internet Explorer browsers are updated by http://www.microsoft.com/ie/, and Netscape browsers updated by accessing http://www.netscape.com/
1. The function called menu which prints the text string "Menu choices", and does not pass any data back, and does not accept any data as parameters, looks like
void menu( void ) { printf("Menu choices"); }
int menu( void ) { printf("Menu choices"); }
int menu( char string[] ) { printf("%s", string); }
2. A function prototype for the above function looks like
3. A function called print which prints a text string passed to it as a parameter (ie, a character based array), looks like
int print( char string[] ) { printf("%s", string); }
void print( char string[] ) { printf("Menu choices"); }
void print( char string[] ) { printf("%s", string); }
4. A function prototype for the above function print looks like
5. A function called total, 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.
int total( int numbers[], int elements ) { int total = 0, loop; for( loop = 0; loop < elements; loop++ ) total = total + numbers[loop]; return total; }
int total( int numbers[], int elements ) { int total = 0, loop; for( loop = 0; loop <= elements; loop++ ) total = total + numbers[loop]; return total; }
int total( int numbers[], int elements ) { int total, loop; for( loop = 0; loop > elements; loop++ ) total = total + numbers[loop]; return total; }
6. A function prototype for the above function looks like
©Copyright B Brown. 1984-1999. All rights reserved.