-10

I had this on a test this week and got it wrong. I asked the professor for help and he said we'd go over it next Thursday. I really don't want to wait that long. Can any one on here walk me through it?

Perform the task specified by the following statements:

Write the function prototype for function "doit" that takes an integer array parameter "list" and an integer "size" parameter and returns a boolean value.

Thanks in advance for any help

gregknight
  • 43
  • 10
  • 3
    What was your wrong answer? – antlersoft Nov 06 '15 at 23:27
  • 2
    I suggest you search the web for explanations of what a "C++ function prototype" is and why it's needed. Then if you have a specific question ask here! :-) – Cameron Nov 06 '15 at 23:28
  • How to declare function: http://stackoverflow.com/questions/1410563/what-is-the-difference-between-a-definition-and-a-declaration – Piotr Siupa Nov 06 '15 at 23:30
  • This is what I had on the test bool doit(list : int[], size : int) : boolean; sorry it took so long, Im at workright now. lol – gregknight Nov 07 '15 at 00:41

3 Answers3

0

A little bit of help is there :

RETURN_TYPE FUNCTION_NAME  (ARGUMENT1_TYPE ARGUMENT1,ARGUMENT2_TYPE ARGUMENT2);

It's not a big deal , it's just a prototype :) I wrote the answer and removed it, u should try looking for the answer in the internet :)

user2268349
  • 33
  • 1
  • 5
0
bool doit(int list[], int size);

The function doit takes an array of integers as first parameter, and the size of the array (which is an integer) as second parameter. It returns a boolean (true or false).

This sort of function prototype is typically used to access each element of the array within a for loop (with size as terminating condition). The boolean return value could inform of the presence or absence of some value in the array for example, or if some work could or could not be performed.

blakelead
  • 1,780
  • 2
  • 17
  • 28
  • Thank you for your help! This is what I had; doit(list : int[], size : int) : boolean; I was close, Thanks again. – gregknight Nov 07 '15 at 00:47
0

Here you go:

+ doit(list : int[], size : int) : boolean
Edward Strange
  • 40,307
  • 7
  • 73
  • 125