CS205-2020 Spring - Lecture 6 PDF
CS205-2020 Spring - Lecture 6 PDF
Language
CS205 Spring
Feng Zheng
2020.03.26
Content
• Brief Review
• Function Review
• Various Functions
• Summary
Brief Review
Content of Last Class
• Loops
➢ for( ; ; )
➢ while( )
➢ do while( )
➢ Increment/decrement operations(++,--)
• Branching
➢ if; if else; if else if else
➢ switch
➢ ?; continue; break;
• The expressions for Loops
➢ Relational expressions (6 operations)
➢ Logical expressions (AND, OR, NOT)
Function Review
Functions
• Three components
➢ Provide a function definition including two parts: head and body
➢ Provide a function prototype
➢ Call the function
• Two types of usage
➢ Use a library function
✓ Including the header file
✓ Static library is locked into at compiling time
✓ Dynamic library exists as a separate file outside of the executable file
➢ Create your own functions
✓ Handle all three aspects
Defining a Function
• Two categories
➢ Don’t have return values
Declare an array of
four pointers-to-int