Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

C Operators: A Comprehensive Guide to Types and Precedence, Study notes of Programming Languages

A concise overview of operators in the c programming language. It covers various types of operators, including arithmetic, relational, logical, bitwise, assignment, comparison, and increment/decrement operators. Each operator type is explained with examples, offering a basic understanding of their functions and usage. The document also includes a table detailing operator precedence in c, which is crucial for writing correct and efficient code. This information is useful for students learning c programming, as it helps them understand how different operators interact and affect the outcome of expressions. The document serves as a quick reference guide for understanding the fundamental concepts of operators in c, aiding in the development of basic programming skills and comprehension of c syntax and semantics.

Typology: Study notes

2021/2022

Available from 05/28/2025

kartikksharma
kartikksharma 🇮🇳

12 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Q: What do you mean by Operators? Explain different types of
operators available in C language?
Ans: Operators
An operator is a symbol that tells the compiler to perform specific
mathematical or logical functions. C language is rich in built-in
operators and provides the following types of operators.
Types:
1. Arithmetic operators
2. Relational operators
3. Logical operators
4. Bitwise operators
5. Assignment operators
6. Comparison operators
7. Increment/Decrement
operators
8. Misc operators
1. Arithmetic Operators:
Arithmetic operators are basically used for performing basic mathematical
operations like addition, subtraction etc.
Eg. +, -, *, /, mod, #
pf3
pf4
pf5

Partial preview of the text

Download C Operators: A Comprehensive Guide to Types and Precedence and more Study notes Programming Languages in PDF only on Docsity!

Q: What do you mean by Operators? Explain different types of

operators available in C language?

Ans: Operators

An operator is a symbol that tells the compiler to perform specific

mathematical or logical functions. C language is rich in built-in

operators and provides the following types of operators.

Types:

1. Arithmetic operators

2. Relational operators

3. Logical operators

4. Bitwise operators

5. Assignment operators

6. Comparison operators

7. Increment/Decrement

operators

8. Misc operators

1. Arithmetic Operators:

Arithmetic operators are basically used for performing basic mathematical

operations like addition, subtraction etc.

Eg. +, -, *, /, mod,

2. Relational operators:

These operators are used or very helpful in handling relations between two or

more variables or operand.

Eg. >, <, >=, <=, ==, =

3. Logical operators:

Logical operators are used to apply different types of logic to one or

more operands.

eg: &&, ||,!

4. Bitwise operators:

Bitwise operators works on bits and perform bit-by-bit operation.

e.g., &, |, ^, ~, etc.

5.Assignment Operator:

Assignment operators are basically used for assigning any value to

the operand.

e.g., =, int a=10, etc.

6. Comparison Operator:

Comparison operators are used to compare values of two or more

operands.

e.g., >, <, >=, <=,

a>b, b<C, C<d etc.

8. Misc operator: There are basically two types of misc operator: Size of and Ternary. ① Size of : It returns the size of a variable. size of (a)Ternary : It returns value into true or false expression? True: false Operator Precedence in C: Category | Operator | Associativity | | Post fix | [] ->. ++ -- | L to R | | Unary | + -! ~ ++ -- | R to L | | Multiplicative | *** / %** | L to R | | Additive | + - | L to R | | Shift | << >> | L to R | | Relational | << => >= | L to R |

| Equality | == != | L to R | | Bitwise AND | & | L to R | | Bitwise XOR | ^ | L to R | | Bitwise OR | ** | **L to R** | | **Logical AND** | **&&** | **L to R** | | **Logical OR** | ** | L to R |

______