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

Types of Operators with examples in C Language., Study notes of Programming Languages

This document provides a comprehensive explanation of operators in the C programming language. It includes detailed coverage of different types of operators such as arithmetic, relational, logical, bitwise, assignment, conditional, and increment/decrement operators. The content is organized with examples and explanations suitable for beginner to intermediate-level students. This material is ideal for students enrolled in computer science or programming courses, and can serve as a useful reference for exam preparation or project development. It may have been used in courses like Introduction to Programming in C or Computer Science 101, and is suitable for students from any university or institution studying C programming.

Typology: Study notes

2022/2023

Available from 05/29/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 in C
Language
In C, operators are special symbols that perform operations on variables and
values. They are used to manipulate data and variables in various ways, like
performing arithmetic, making comparisons, assigning values, and more.
Types of Operators in C
Here are the main types of operators in C:
1. Arithmetic Operators
Used to perform mathematical operations.
Examples:
+ (Addition)
- (Subtraction)
* (Multiplication)
/ (Division)
% (Modulus - remainder)
pf3
pf4
pf5

Partial preview of the text

Download Types of Operators with examples in C Language. 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 in C

Language

In C, operators are special symbols that perform operations on variables and values. They are used to manipulate data and variables in various ways, like performing arithmetic, making comparisons, assigning values, and more.

Types of Operators in C

Here are the main types of operators in C:

1. Arithmetic Operators

Used to perform mathematical operations.

Examples:

  • (Addition)
  • (Subtraction)
  • (Multiplication)

/ (Division)

% (Modulus - remainder)

2. Relational (Comparison) Operators

Used to compare two values.

Result is either true (1) or false (0).

Examples:

== (Equal to)

!= (Not equal to)

(Greater than)

< (Less than)

= (Greater than or equal to)

<= (Less than or equal to)

3. Logical Operators

Used to combine multiple conditions.

Examples:

&& (Logical AND)

|| (Logical OR)

! (Logical NOT)

<< (Left shift)

(Right shift)

7. Conditional (Ternary) Operator

Shorthand for if-else statement.

Syntax: condition? value_if_true : value_if_false

8. Sizeof Operator

Returns the size (in bytes) of a data type or variable.

Example: sizeof(int)

9. Comma Operator

Allows two expressions to be evaluated in a single statement.

Example: a = (b = 3, b + 2); (assigns 5 to a)

10. Pointer Operators

Used for pointer operations.

  • (Dereference operator)

& (Address-of operator)