Operators and Arithmetic Operations. Operators An operator is a symbol that instructs the code to perform some operations or actions on one or more operands.

Презентация:



Advertisements
Похожие презентации
Sequences Sequences are patterns. Each pattern or number in a sequence is called a term. The number at the start is called the first term. The term-to-term.
Advertisements

Operator Overloading Customised behaviour of operators Chapter: 08 Lecture: 26 & 27 Date:
HPC Pipelining Parallelism is achieved by starting to execute one instruction before the previous one is finished. The simplest kind overlaps the execution.
Unit II Constructor Cont… Destructor Default constructor.
Multiples Michael Marchenko. Definition In mathematics, a multiple is the product of any quantity and an integer. in other words, for the quantities a.
SPLAY TREE The basic idea of the splay tree is that every time a node is accessed, it is pushed to the root by a series of tree rotations. This series.
© 2005 Cisco Systems, Inc. All rights reserved. BGP v Route Selection Using Policy Controls Applying Route-Maps as BGP Filters.
Dictionary divided into 2 or 3 panes: The left-hand pane shows the categories of objects that can be used in checks. The mid-pane lists the sub-categories.
Michael Marchenko. In mathematics, a sequence is an ordered list of objects (or events). Like a set, it contains members (also called elements, or terms),
taxes
Combination. In mathematics a combination is a way of selecting several things out of a larger group, where (unlike permutations) order does not matter.
Conditional Statements. Program control statements modify the order of statement execution. Statements in a C program normally executes from top to bottom,
Here are multiplication tables written in a code. The tables are not in the correct order. Find the digit, represented by each letter.
© 2006 Cisco Systems, Inc. All rights reserved. HIPS v Configuring Rules Rule Basics.
© 2009 Avaya Inc. All rights reserved.1 Chapter Two, Voic Pro Components Module Two – Actions, Variables & Conditions.
Polynomial In mathematics, a polynomial is an expression of finite length constructed from variables (also called indeterminates) and constants, using.
© 2005 Cisco Systems, Inc. All rights reserved. BGP v Customer-to-Provider Connectivity with BGP Connecting a Multihomed Customer to Multiple Service.
Modeling Combinational Logic Ando KI June Copyright © 2009 by Ando KiModule overview ( 2 ) Typical Combinational Components Multiplexer Encoder.
Chapter 6 Digital Arithmetic: Operations and Circuits ECE 221 Intro. Digital Systems Fall Semester 2002 ECE Department, UMASS-Amherst Prof. Hill Prof.
How can we measure distances in open space. Distances in open space.
Транксрипт:

Operators and Arithmetic Operations

Operators An operator is a symbol that instructs the code to perform some operations or actions on one or more operands. C operators are categorized to several types: assignment operator assignment operator mathematical operators mathematical operators relational operators relational operators logical operators logical operators

Assignment Operator The assignment operator which is the equal sign ( = ). If you write c = y in a C program, the value of y is assigned to c. In assigning, the right side can be any expression and the left side must be a variable name.

Mathematical Operators C mathematical operators can be classified into two: unary and binary Binary operators Mathematical operators perform math operations such as: addition ( + ), subtraction ( - ), multiplication ( * ), division ( / ) and modulus ( % ). addition ( + ), subtraction ( - ), multiplication ( * ), division ( / ) and modulus ( % ).

Mathematical Operators Unary operators C has two unary operators: the increment and the decrement Prefix or infix = ++x for increment and - - x for decrement Postfix = x++ for increment and X - - for decrement

Operator Precedence An expression contains more than one operator. The order in which operations are performed pose a significance. This order is called operator precedence. Operations with higher precedence are performed first when an expression is evaluated. Operators Relative Precedence Operators Relative Precedence * / %2 + -3

If an expression contains more than one operator with the same precedence level, the operators are performed in left to right order as they appear in the expression. C also uses parentheses to modify the evaluation order. A sub expression enclosed in parentheses is evaluated first without regard to operator precedence.

Relational Operators OperatorSymbolExample Equal==X==A Not equal !=A!=0 Less than <X<0 Greater than >y>10 Less than or equal to <=X<=20 Greater than or equal to >=Y>=100

Logical Operators OperatorSymbolExample and&& var1 & & var2 or|| var1 | | var2 not!!var1