QP School

Full Version: Storing an integer in C
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Description:

The int data type in C is used to store whole numbers (integers). It typically occupies 4 bytes of memory (though the size can vary depending on the system), and it can represent both positive and negative values.

Example:

int num = 42;

Explanation:

In this example, we declare a variable num of type int.
We initialize it with the value 42.
The int data type can store integer values within the range of -2,147,483,648 to 2,147,483,647 (on most systems).