Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Notes  >  Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE) PDF Download

Introduction

 

The slides cover the following topics:

  1. C operators
  2. Operator Precedence

 

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

 

C OPERATORS, OPERANDS, EXPRESSION & STATEMENTS

 

Operators are symbols which take one or more operands or expressions and perform arithmetic or logical computations. 
 
Operands are variables or expressions which are used in conjunction with operators to evaluate the expression.
 
•Combination of operands and operators form an expression
 
•Expressions are sequences of operators, operands, and punctuators that specify a computation.
 
•Evaluation of expressions is based on the operators that the expressions contain and the context in which they are used.
 
•Expression can result in a value and can produce side effects.
 
•A side effect is a change in the state of the execution environment. 
 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

C OPERATORS

 

•An expression is any valid set of literals, variables, operators, operands and expressions that evaluates to a single value.
 
•This value can be a number, a string or a logical value.
 
•For instance a = b + c; denotes an expression in which there are 3 operands a, b, c and two operator + and =.
 
•A statement, the smallest independent computational unit, specifies an action to be performed.
•In most cases, statements are executed in sequence.
 
•The number of operands of an operator is called its arity.
 
•Based on arity, operators are classified as nullary (no operands), unary (1 operand), binary (2 operands), ternary (3 operands).
 
C Operators, Operands, Expressions & Statements---------------------------------------------Next slide
 
 
C OPERATORS
 
 
Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

C OPERATORS

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

 
1.Example 1: function call operator
2.Example 2: array subscripting operator
3.Example 3: pointer dot and arrow operator
 
C Operators, Operands, Expressions & Statements---------------------------------------------Next slide
 

 

C OPERATORS
 
 
Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)
 
C Operators, Operands, Expressions & Statements---------------------------------------------Next slide
 
 
C OPERATORS
 
 
Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)
 
C Operators, Operands, Expressions & Statements---------------------------------------------Next slide
 
 
C OPERATORS
 
 
Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)
 
C Operators, Operands, Expressions & Statements---------------------------------------------Next slide
 
 
C OPERATORS
 
 
Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

Program example: plus, minus, address-of, pre and post increment/decrement, sizeof() and type promotion

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

C OPERATORS

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

 

C OPERATORS

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

Program example: assignment, add, subtract, multiply, divide and modulus

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

C OPERATORS

 

•For relational expression, 0 is FALSE, 1 is TRUE.
 
•Any numeric value is interpreted as either TRUE or FALSE when it is used in a C / C++ expression or statement that is expecting a logical (true or false) value. The rules are:
1.A value of 0 represents FALSE.
2.Any non-zero (including negative numbers) value represents TRUE.
 

Program example: true, false and negate

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

C OPERATORS

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

 

C OPERATORS

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

C OPERATORS

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

Program example: less-than, greater-than, less-than and equal-to, greater-than and equal-to, not-equal, equal and assignment operators

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

C OPERATORS

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

C OPERATORS

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

C OPERATORS

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

Program example: Logical-AND, logical-OR, logical-NOT, XOR operators

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

C OPERATORS

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

 

Program example: tenary conditional operator

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

C OPERATORS

 

•The compound assignment operators consist of a binary operator and the simple assignment operator.
 
•They perform the operation of the binary operator on both operands and store the result of that operation into the left operand.
 
•The following table lists the simple and compound assignment operators and expression examples:
 
C Operators, Operands, Expressions & Statements---------------------------------------------Next slide
 
 
C OPERATORS
 
 
Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)
 
 
C Operators, Operands, Expressions & Statements---------------------------------------------Next slide
 
 
C OPERATORS
 
 
Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)
 

Program example: compound operators

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

C OPERATORS

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

C OPERATORS

 

•The following table gives some examples of the uses of the comma operator.

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

C OPERATORS

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

C OPERATORS

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

C OPERATORS

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

Program example: bitwise shift left, bitwise shift right and bitwise-NOT operators

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

C OPERATORS

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

C OPERATORS

 

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

C OPERATORS

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

C OPERATORS

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

 

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

C OPERATORS

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

 

C OPERATORS

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

Program example: bitwise-AND, bitwise-OR and eXclusive-OR (XOR) operators

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

OPERATOR PRECEDENCE

 

Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

 

C Operators, Operands, Expressions & Statements---------------------------------------------Next slide

 

OPERATOR PRECEDENCE

 

•Operator precedence: a rule used to clarify unambiguously which operations (operator and operands) should be performed first in the given (mathematical) expression.
 
•Use precedence levels that conform to the order commonly used in mathematics.
 
•However, parentheses take the highest precedence and operation performed from the innermost to the outermost parentheses.

 

 

 

 

 

The document Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE) is a part of Computer Science Engineering (CSE) category.
All you need of Computer Science Engineering (CSE) at this link: Computer Science Engineering (CSE)
Are you preparing for Computer Science Engineering (CSE) Exam? Then you should check out the best video lectures, notes, free mock test series, crash course and much more provided by EduRev. You also get your detailed analysis and report cards along with 24x7 doubt solving for you to excel in Computer Science Engineering (CSE) exam. So join EduRev now and revolutionise the way you learn!
Sign up for Free Download App for Free

FAQs on Chapter - C Operators, Operands, Expressions & Statements, PPT, PF, Semester, Engineering - Computer Science Engineering (CSE)

1. What are operators in C programming?
Operators in C programming are symbols that are used to perform operations on operands. They can be classified into different categories such as arithmetic, relational, logical, bitwise, assignment, and more. Operators manipulate the values of operands and produce a result.
2. What are operands in C programming?
Operands in C programming are the values on which operators perform the operation. They can be constants, variables, or expressions. For example, in the expression "a + b", 'a' and 'b' are the operands.
3. What is the difference between an expression and a statement in C programming?
In C programming, an expression is a combination of operators, constants, variables, and function calls that evaluates to a single value. It can be used in various contexts, such as assignments, function arguments, and conditional statements. On the other hand, a statement is a complete line of code that performs a specific action. It can include expressions, control flow structures (if-else, loops), and function calls. Statements are used to control the flow of execution in a program.
4. How do I write an if-else statement in C programming?
To write an if-else statement in C programming, you can use the following syntax: ``` if (condition) { // code to be executed if the condition is true } else { // code to be executed if the condition is false } ``` The condition is an expression that evaluates to either true or false. If the condition is true, the code inside the if block is executed. Otherwise, the code inside the else block is executed.
5. What is the purpose of the assignment operator in C programming?
The assignment operator (=) in C programming is used to assign a value to a variable. It takes the value on its right-hand side and assigns it to the variable on its left-hand side. For example, `x = 5;` assigns the value 5 to the variable x. The assignment operator can also be used in combination with other operators, such as `+=`, `-=`, `*=`, etc., to perform compound assignments. These operators combine the arithmetic operation with assignment. For example, `x += 5;` is equivalent to `x = x + 5;`, where the value of x is incremented by 5.
Download as PDF
Related Searches

MCQs

,

PPT

,

Expressions & Statements

,

video lectures

,

PF

,

Free

,

Operands

,

Semester

,

Chapter - C Operators

,

Expressions & Statements

,

Chapter - C Operators

,

Viva Questions

,

Summary

,

Semester Notes

,

Previous Year Questions with Solutions

,

Semester

,

Sample Paper

,

pdf

,

Extra Questions

,

practice quizzes

,

Engineering - Computer Science Engineering (CSE)

,

Operands

,

Expressions & Statements

,

Semester

,

Exam

,

Operands

,

PF

,

PPT

,

Engineering - Computer Science Engineering (CSE)

,

shortcuts and tricks

,

mock tests for examination

,

Important questions

,

study material

,

Engineering - Computer Science Engineering (CSE)

,

ppt

,

past year papers

,

PPT

,

PF

,

Objective type Questions

,

Chapter - C Operators

;