suppose i write one program and then compile it,on compilation an .exe file is generated and i copy that .exe file to another computer(both computer have no link or conection b/w them , i copied using pendrive),
According to prateek bhaiya the size and address at which memory will get allocated gets fixed at compilation time in virtual memory and gets actual allocation at runtime in ram right?
Now suppose at the address which is actually stored inside the virtual memory is already in use by some other program in other computer(in which i have copied my exe file) and i run that exe file… what will happen then?
COMPILE TIME MEMORY ALLOCATION
Hey @sagar_aggarwal, first off all only .exe file won’t help, you need other dependencies as well to run the program (.cpp source file and .o file if it exists)
Now coming to your doubt, yes the program would try accessing the same address (virtual) and if no such address is there or access is denied(due to encryption or already in use by other application) then your compilation will be unsuccessful.
.o files exist in linux only right? and i have tried many programs they work without source code as the machine level code is only required by operating system to understand my program which is .exe file. for windows operating system. source code is only needed by compiler to work upon. kindly ping me if i am wrong @mayankA47
No .o files exist for windows.
Yes you are right on that part as I was talking in sense that you will run on an IDE!
But only .exe gives desired output?(coz it doesn’t atleast on my sytem although it executes)
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.