We know that pointers in C are used to store memory address of anything but what memory is this? I mean that is it RAM or hard disk? For variable i can conclude that it must be RAM because variables exist only when the program is running. But what about functions? If I make a pointer that points to a function then it must point to the address of the function in the hard disk because the functions exist even when the program is not running. If this is so then how can we know by looking at the memory address that whether it corresponds to RAM or the hard disk?
And also, for example if I have a program that occupies 10MB in hard disk and when I run the program, first of all the program is loaded into RAM. Do the program occupies 10MB in RAM also? If not then what factors decide the memory occupied by the program in RAM?