C Programming

⌘K
  1. Home
  2. Docs
  3. C Programming
  4. Operators and Expression
  5. Introduction to Operators

Introduction to Operators

Operators are special symbols or keywords used to perform operations on variables and values.

Thank you for reading this post, don't forget to subscribe!
  • They are used to manipulate data and variables in C.

Types of Operators in C:

Types of Operators in C

Example:

#include <stdio.h>

int main() {
    int a = 10, b = 5;
    int sum = a + b;       // Arithmetic
    int isEqual = (a == b); // Relational
    int logical = (a > 0 && b > 0); // Logical
    a += 2;                // Assignment
    int size = sizeof(a);  // Sizeof
    int max = (a > b) ? a : b; // Ternary

    printf("Sum: %d\n", sum);
    printf("Is Equal: %d\n", isEqual);
    printf("Logical AND: %d\n", logical);
    printf("Size of a: %d bytes\n", size);
    printf("Max: %d\n", max);

    return 0;
}

How can we help?