I've been trying to understand how the malloc function in C dynamically allocates memory, and I'm not entirely clear on it. I read some theory but still have some questions.

Let's look at this line of code as an example:

Code:
int *ptr = (int *)malloc(sizeof(int));

I understand that ptr is declared as a pointer to an integer. What's puzzling me is the statement that "malloc returns a pointer to the first byte of the allocated memory."


If I get it correctly, ptr should hold the memory address where integer variables can be stored. But what does it mean by "malloc returns a pointer to the first byte of the allocated memory"? Does this imply that ptr is holding another pointer that points to the actual memory?