---
title: 3.6 Assignment Operator
description: "The assignment operator `=` assigns the value of the expression on its right to the variable on its left. ``` #include int main() { int number; number = 10; printf(\"number = %d\\n\", number); number = 25; printf(\"number = %d\\n\", number);…"
url: "https://edcret.in/docs/c-programming/operators-and-expressions/3-6-assignment-operator/"
updated: "2026-09-07"
category: C Programming / Operators and Expressions
---

# 3.6 Assignment Operator

The assignment operator `=` assigns the value of the expression on its right to the variable on its left.

```
#include <stdio.h>

int main()
{
    int number;

    number = 10;

    printf("number = %d\n", number);

    number = 25;

    printf("number = %d\n", number);

    return 0;
}
```

### Example Output

```
number = 10
number = 25
```

### Explanation

The assignment:

```
number = 10;
```

stores the value `10` in `number`.

A later assignment:

```
number = 25;
```

replaces the previous value with `25`.

The right side of an assignment is evaluated first, and its result is assigned to the left operand. The left operand must be a modifiable object that can store the resulting value.
