Hey guys, I'm obviously somewhat new to C and am having problems passing pointers between functions in two different .c files.
Basically, I have this in main.c:
...
printf("Address of jump: %d\n", &jump);
store(&jump, address, op);
...
and in table.c I have:
void store(table *tab, int val, char* k)
{
printf("Address of received table: %d\n", &tab);
...
jump itself is declared in a global header file. It is a typedef struct.
When I run the program, I get this:
Address of jumpTable: 17669248
Address of received table: 3341436
Why on Earth are the addresses being pointed to changing when I pass them to different functions? I've been looking around everywhere I can for answers but have not been able to find any. Please help me out!
* Obviously I've removed most of my program to focus on what (I think) are the relevant bits. If more info is needed, please just let me know.



LinkBack URL
About LinkBacks



