Content
what is a function?
A function is a set of statements that are put together to perform a specific task.
what is the name of the function?
void comSci () {
printf ("We love com sci");
}
comSci
syntax of a function
return_type function_name () {
function body
}
write a function to print "Happy Tuesday"
void myFunction () {
printf ("Happy Tuesday");
}
parameters vs arguments
parameters-placeholders for values
arguments- actual values inputted
declare a global variable
int globalVar = 2;
what is the purpose of our IA?
To track and manage books and overdue fines in a library
Function syntax in our IA
float overdue (int days, float rate) {
return days * rate;
}