Fundamental Objects in the C Language
Part 3 of Complete C Course
Foreword: This tutorial explains the fundamental objects in C.
By: Chrysanthus Date Published: 31 May 2024
Introduction
Object
The computer memory is a series of cells, and each cell can store one character. That is, each cell can store a byte. There are fundamental objects and derived objects, in C. A fundamental or derived object, can occupy more than one consecutive bytes in the memory. Such sequence of bytes is called a location. Any number such as 538, stored in memory, is called a datum. The plural of datum is data. Data are of different forms, not just numbers. A datum is stored in memory in a short series of consecutive cells.
A fundamental object occupies a small region (small group of consecutive cells) in memory. Some derived objects (see below) take long regions in memory.
The cells of the computer memory are numbered numerically. These numbers are called memory addresses.
An object is a region in memory with a practical value or information. There is a difference between location and region. A region can consist of more than one location. The smallest location is one byte long. The location of an integer (see later) is four bytes long. The location of a long-integer (see later) is eight bytes long. An array object (see later) can consist of many consecutive integers (many consecutive locations).
int
An integer abbreviated, int in C, can be the value of an object. In other words the value (content) of an object can be of type, Integer. An integer is a whole number, e.g. 6987 or -6987. The following variants with different bit widths of integer, exist: short int, int, long int, and long long int.
float
In C, a float is a number with a decimal point, e.g. 45.36. The following variants of float exist: float, double, and long double. A double number has more precision (see later) than a float. The bit width of a double number, is usually two times that of a float number.
char
Character abbreviated, char in C is a character, e.g. A, a, B, b, 1, 3, 5, etc. The value of an object can be a character. Such an object is one byte long, and will be stored in just one cell in memory. Usually, when we talk about the char object type, we are talking about only one single character (in Western Europe and U.S.A) .
bool
There is something called, Boolean. In life a Boolean value is either true or false. In C, true is the number, 1 and false is the number, 0. An object can hold a Boolean type, which is either 1 or 0. In C, Boolean is written as, _Bool.
void
When the type of datum in an object is said to be void, it means that the region of the object is empty. This empty region is not reserved for an int, float, or any of the other object types.
Derived types
In C, there are certain types of objects that are called derived types. A derived object type is a combination of two or more fundamental types of object. One example of the derived object type is called, enumeration. Another example is called the pointer. There are other derived object types.
Conclusion
The fundamental object types addressed in this tutorial are: int, float, char, bool (_Bool), and void. The details of derived object types are explained later in the course.