Chapter 6 User-Defined Functions I
Chapter 6 User-Defined Functions I
3
Predefined Functions (continued)
4
Predefined Functions (continued)
• pow(x,y) calculates xy
– pow(2, 3) = 8.0
– Returns a value of type double
– x and y are the parameters (or arguments)
• sqrt(x) calculates the nonnegative square
root of x, for x >= 0.0
– sqrt(2.25) is 1.5
– Type double
5
Predefined Functions (continued)
6
Predefined Functions (continued)
7
Predefined Functions (continued)
8
Predefined Functions (continued)
• Syntax:
20
return Statement
r=sum(x,y,z);
return 0;
}
int s;
s=a+b+c;
return s;
} 29
30
31
Flow of Execution