1 / 14

Computer Science

Computer Science. By: Erica Ligons. Compound Statement. A compound statement- is a unit of code consisting of zero or more statement also known as a block. Model Of Statement. Expression Statement. Compound Statement. Selection Statement. Statement. Labeled Statement.

Download Presentation

Computer Science

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Science By: Erica Ligons

  2. CompoundStatement • A compound statement- is a unit of code consisting of zero or more statement also known as a block

  3. Model Of Statement Expression Statement Compound Statement Selection Statement Statement Labeled Statement Iterative Statement Jump Statement

  4. Purpose of the Compound Statement • The compound statement allows it user to make groups of statements into a single chunk • Parts of Compound Statement Opening Brace Closing Brace

  5. Functions • 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

  6. Side Effects of Functions • Side effects- occurs when the is a change in the state of the program Aspects of a Side Effect • Accepting data from outside source • Sending data to monitor or file • Changing the value of a variable

  7. Function Declaration • Function declaration- is done with a prototype declaration Purposes For Calling A Functions Name • When a function is declared • When it is called • When it is defined

  8. 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

  9. Parameter Passing Can pass parameter in two ways: • Pass by value- a copy of the data is created and placed in a local variable in the called function • Pass by reference- sends the address of a viable to the called function

  10. Function Definition • Function definition- contains the code for 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 body- contains declarations and statements for the functions

  11. Selection • If else- use for two-way selections • Switch Selection- does the same as if else

  12. 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

  13. THE END

  14. Expression Statement Compound Statement Selection Statement Statement Labeled Statement Iterative Statement Jump Statement

More Related