Expressions - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

Expressions

Description:

Chapter 4 Functions Instructor: Bindra Shrestha University of Houston Clear Lake Acknowledgement Structured Programming Approach Using C By Behrouz A. Forouzan ... – PowerPoint PPT presentation

Number of Views:106
Avg rating:3.0/5.0
Slides: 18
Provided by: bind4
Category:

less

Transcript and Presenter's Notes

Title: Expressions


1
Chapter 4 Functions Instructor Bindra
Shrestha University of Houston Clear Lake
2
Acknowledgement Structured Programming
Approach Using C By Behrouz A. Forouzan and
Richard F. Gilberg  
3
Function Modules
4
Function calls
5
Parameters and Return
6
Void Parameter and Void Return
7
Pass by Value, Return Void
8
Pass by Value
9
Function Defination
10
Passing two values by copy
  • A compound assignment is a shorthand notation for
    a simple assignment.
  • Compound assignment operators are
  • , /, , , and -
  • For exampleFor xy, equivalent simple
    expression is x x y
  • Similarly,
  • x / y is x x/y
  • x - y 4 is x x- ( y 4)
  • x y is x x y
  • x y2 is x x ( y 2).

11
  • The postfix increment/decrement operates at the
    second level of the Precedence Table ( see inside
    front cover)
  • a Here a is an operand while is a postfix
    operator.
  • a has the same effect as a a1.
  • Although the result of both expression is the
    same, there is a major difference.For example If
    variable a contains 4 before the expression is
    evaluated, the value of the expression a is 4
  • After the evaluating the expression and its side
    effects, then only a becomes 5.

















12
Different ways of calling
  • include ltstdio.hgt
  • int main (void) / example of Postfix
    increment/
  • int a
  • a 5
  • printf("d\t", a)
  • printf("d\t", a)
  • printf("d\n", a)
  • return 0
  • / Results
  • 5 5 6
  • /

13
One-way communication
14
Two-way communication
15
Two-way swapping values example
16
Mixed communication
17
Variable Scopes
Write a Comment
User Comments (0)
About PowerShow.com