Download presentation
Presentation is loading. Please wait.
Published byFlora Ryan Modified over 9 years ago
2
Computer Science By: Erica Ligons
3
Compound Statement A compound statement- block A compound statement- is a unit of code consisting of zero or more statement also known as a block
4
Model Of Statement Expression Statement Compound Statement Selection Statement Labeled Statement Iterative Statement Jump Statement Statement
5
Purpose of the Compound Statement 1. The compound statement allows it user to make groups of statements into a single chunk 2. Parts of Compound Statement Opening Brace Closing Brace
6
Functions Function- Function- a subroutine The “C” Program consist of many functions, however, only one of the functions can be called a main The main has the ability to allocate special tasks The purpose of the function is to be able to receive one or more pieces of data
7
Side Effects of Functions Side effects- occurs when the is a change in the state of the program Side effects- occurs when the is a change in the state of the program Aspects of a Side Effect 1. Accepting data from outside source 2. Sending data to monitor or file 3. Changing the value of a variable
8
Function Declaration Function declaration- Function declaration- is done with a prototype declaration Purposes For Calling A Functions Name 1. When a function is declared 2. When it is called 3. When it is defined
9
Function Call Function call- is used for the purpose of calling a function Actual parameters-represent the values tat are to be sent to the called function
10
Parameter Passing Can pass parameter in two ways: Pass by value Pass by value- a copy of the data is created and placed in a local variable in the called function Pass by reference- Pass by reference- sends the address of a viable to the called function
11
Function Definition Function Function definition- definition- contains the code for functions. It has two parts the header and function of the body. Function Header Parts 1.The return type 2. The function name 3. Compound statement Function Function body- body- contains declarations and statements for the functions
12
Selection If else- If else- use for two-way selections Switch Selection- Switch Selection- does the same as if else
13
Loops There are three types of loops While loop- checks the value of a testing expression, pretest For loop- it is a counter-control loop, pretest Do-while loop- event controlled loop, but it is a posttest loop
15
Expression Statement Compound Statement Selection Statement Labeled Statement Iterative Statement Jump Statement Statement
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.