CSC209H5 Chapter Notes - Chapter 2: Function Prototype, C Mathematical Functions

14 views2 pages

Document Summary

Csc209h5s - software programming and tools (winter 2018) Example: double larger_sum = fmax(2, 3); #output larger number, 3 printf ( "hello" ); #print function to output text. You also need to include where the function is coming from: It is possible to use a function call where you would normally call a variable double nested_result = fmax(num2, fmax( 0. 1 *num1, 10 )); printf( "larger number is %f. Float larger, largest; larger = fmax(num2, num4); largest = fmax(num1, larger); printf( "the largest value is: %0. 2f" , largest); //replace the code below with a single line. Float largest = fmax(num1, fmax(num2, (num1*num2)/num3)); printf( "the largest value is: %0. 2f" , largest); In order to create a function declaration, you must start with a type (return type), the name and arguments. (function prototype) double test_fmax( double x, double y); In the example above, the function will return a double variable.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents