The operating system provided you the bytes.
Why did you do that?
Well, you may have needed something dynamically in the computation.
The typical reason to use calloc() or
malloc() was I don't know how much data I'm gonna process.
I have a very large file.
The first entry of the file tells me how much data is sitting in the file.
So, it tells me I need to process
400,000 social security numbers.
Now I need something that can store 400,000 Social Security numbers.
Well, that means they need a very large array.
So, dynamically, during the computation, by calling malloc or
calloc, I can access the heap.
Assigned to a pointer, which we could think of as a base pointer,
that much memory, and then use the dynamically allocated object.
And then, good programmers don't allow for memory leaks.
And so when I no longer need that memory, I would deallocate it,
and the standard way I deallocate and C is to use free.