Given the basic memory sections of text, data, stack, and heap, where would the address of a function be stored?
I know it depends on the hardware architecture and compiler, But for general processes, I am interested to understand I think that function addresses are stored in the text memory.
I've written a small code to explore this further. Can you confirm if it's true that the addresses of those functions will indeed be stored in the text memory?
I know it depends on the hardware architecture and compiler, But for general processes, I am interested to understand I think that function addresses are stored in the text memory.
I've written a small code to explore this further. Can you confirm if it's true that the addresses of those functions will indeed be stored in the text memory?
C:
#include <stdio.h>
void foo()
{
printf("Welcome \n");
}
int add ( int a, int b)
{
int addition = a + b;
return addition;
}
int main() {
foo();
int result = add ( 5, 2);
printf("%d\n", result);
return 0;
}