C

C Tutorial — Learn C Programming

Key takeaway: This free C tutorial teaches you systems programming from scratch — variables, pointers, arrays, functions, structs, and memory management — with practical code examples you can compile and run.

C is a general-purpose, procedural programming language created in 1972. It is used for operating systems, embedded systems, game engines, and performance-critical applications. This tutorial is for beginners, CS students, and developers who want to understand how computers work at a low level.

Last updated: September 2026

Operators in C

Operators are symbols that perform operations on variables and values. C provides a rich set of operators for different types of operations.

Arithmetic Operators

Used to perform mathematical operations:

OperatorDescriptionExampleResult
+Addition5 + 38
-Subtraction5 - 32
*Multiplication5 * 315
/Division15 / 35
%Modulus (remainder)7 % 31

Assignment Operators

= Simple Assignment

x = 5; assigns 5 to x

+= Add and Assign

x += 3; same as x = x + 3;

-= Subtract and Assign

x -= 2; same as x = x - 2;

*= Multiply and Assign

x *= 4; same as x = x * 4;

Comparison Operators

Used to compare two values and return true (1) or false (0):

== Equal to
!= Not equal to
> Greater than
< Less than
>= Greater than or equal
<= Less than or equal
Operators Example
#include <stdio.h>

int main() {
    int a = 10, b = 3;
    
    // Arithmetic operators
    printf("Arithmetic Operations:\n");
    printf("%d + %d = %d\n", a, b, a + b);
    printf("%d - %d = %d\n", a, b, a - b);
    printf("%d * %d = %d\n", a, b, a * b);
    printf("%d / %d = %d\n", a, b, a / b);
    printf("%d %% %d = %d\n", a, b, a % b);
    
    // Assignment operators
    int x = 5;
    printf("\nAssignment Operations:\n");
    printf("x = %d\n", x);
    x += 3;
    printf("After x += 3: %d\n", x);
    x *= 2;
    printf("After x *= 2: %d\n", x);
    
    // Comparison operators
    printf("\nComparison Operations:\n");
    printf("%d == %d: %d\n", a, b, a == b);
    printf("%d > %d: %d\n", a, b, a > b);
    printf("%d < %d: %d\n", a, b, a < b);
    
    return 0;
}

Explanation

  • Arithmetic:+, -, *, /, % perform math on numeric types.
  • Assignment: Compound operators like +=, *= update variables succinctly.
  • Comparison: Return 1 (true) or 0 (false) and are commonly used in conditions.
  • Common pitfalls: Integer division truncates results; operator precedence can surprise—use parentheses to be explicit.
Keywords
C operators, arithmetic, assignment, comparison, precedence, integer division
Quick Tips
  • Use parentheses to control evaluation order and improve readability.
  • Be mindful of integer division; cast to double for precise results.
  • Prefer clear, simple expressions over clever but confusing ones.

Frequently Asked Questions

C is a foundational systems programming language that's been around since the 1970s. It's the base for Linux, Windows, and most operating systems. Learning C gives you deep understanding of memory, pointers, and how computers work — skills that transfer to every other language. According to the TIOBE Index, C consistently ranks in the top 2 most popular languages.

No, zero experience needed. Our C programming tutorial is designed for complete beginners. We start with Hello World and gradually progress to pointers and memory management. Basic computer literacy and logical thinking are helpful but not required.

Just a C compiler — or use our free online compiler. For beginners, our online C compiler requires no installation. For local development, use GCC (available on all platforms). IDEs like VS Code, Code::Blocks, or Dev-C++ also work well.

2–4 weeks for basics, 3–6 months for proficiency. With 1–2 hours daily practice, you can learn syntax, loops, and functions in a few weeks. Mastering pointers, memory management, and data structures takes 6–12 months. Practice with our C programming examples.

C programming skills open doors to various career paths including system programming, embedded systems development, operating system development, device driver programming, game development, and firmware development. Many companies in automotive, aerospace, telecommunications, and IoT sectors actively seek C programmers.

Yes, extremely relevant. C consistently ranks in the top 2 on TIOBE and powers Linux, embedded systems, IoT, automotive software, and game engines. Understanding C makes you a better programmer in any language since most runtimes (Python, Java, Node.js) are themselves written in C.