[COSC 051] - Final Exam Guide - Everything you need to know! (32 pages long)

218 views32 pages

Document Summary

Function definition: int main() cout << hello world\n ; return 0; Line 1: int is the return type. main is the function name. The parentheses ( ) indicate a parameter list. In the case that there is nothing in between the parentheses, the parameter list is empty. The prototypee must include the data type of each parameter in its (). The header must include a declaration, with variable type and name, for each parameter in its () The call for the above function would look like this: evenorodd(val) *note: no data type on argument in call* The value of the argument is copied into the parameter when the function is called. There must be a data type listed in the prototype () and an argument declaration in the function heading () for each parameter. Arguments will be promoted/demoted as necessary to match parameters.