



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
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
1 / 5
This page cannot be seen from the preview
Don't miss anything!
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.
Here are the main types of operators in C:
Used to perform mathematical operations.
Examples:
/ (Division)
% (Modulus - remainder)
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)
Used to combine multiple conditions.
Examples:
&& (Logical AND)
|| (Logical OR)
! (Logical NOT)
<< (Left shift)
(Right shift)
Shorthand for if-else statement.
Syntax: condition? value_if_true : value_if_false
Returns the size (in bytes) of a data type or variable.
Example: sizeof(int)
Allows two expressions to be evaluated in a single statement.
Example: a = (b = 3, b + 2); (assigns 5 to a)
Used for pointer operations.
& (Address-of operator)