Which part of the computer allocates memory in RAM? When we declare a variable there will be a random part of memory will be allocated in RAM. Which component will allocate the memory? Is the processor or any other specific hardware doing the allocation?
It is a combination of the standard C library (usually) and the operating system. No hardware is involved. Check out this answer on stackoverflow for more details.