โญ Key Highlights
- Understand how When writing a C programming language, the size of an array is one of the most perplexing variables to a beginner.
- Know what an Array actually stores (and what it does not store) in the C Programming language.
- Make a discovery on how the sizeof operator can be used to compute array sizes in a safe manner.
- Real-life scenarios of my learning C during the early years. The errors committing developers (even experienced ones).
- Working examples of the code you can use right away. The resources, both internal and external, to keep on learning.

C programming language
๐ง What Is Actually Happening Under the Covers When Working in the C Programming Language?
You will swiftly learn something important: arrays are not magic boxes. They are only blocks of contiguous memory. That is all.
And as much as we would like C to say
“Hey buddy, you have an array with 5 items.”
It does not.
An array in the C programming language only stores the values; nothing else.
However, C does have one wonderful tool: sizeof
It lets us know how large something is in memory.
That is the cracked door that we need.
๐งฉ How size of Can Be Used to Find the Size of an Array
This is the trick I learned in college (after not realizing it for two weeks ๐):

Formula:
Total size of array in bytes / size of one element = number of elements
Let me break this down with the example that finally made sense to me:
int numbers[] = {10, 20, 30, 40, 50};
int totalBytes = sizeof(numbers);
int singleElement = sizeof(numbers[0]);
int length = totalBytes / singleElement;
The Output:
5
In the C programming language, this trick works nicely for you, as long as the array has not decayed to its pointer.

