Trying to figure out what a function pointer is? Is this the address in the code segment where the function is located?
For example: this piece of code:
#include <stdio.h> void foo(void) { } int main(void) { int a = 10; printf("a address: %p\n", &a); printf("foo address: %p\n", foo); return 0; }
... prints this:
[sh/prog-exercises/adam]:./a.out a address: 0xbfffb414 foo address: 0x8048430
I guess I'm a little confused about how exactly the stack / heap of the process is related to the ELF data segment / code segment. Any helpful pointers would really be welcome. Also, my first question is, so please be careful, I am really trying to learn. Thanks!
c pointers function-pointers
helpmelearn
source share