In foo1 and foo2 you are printing out the addresses of local variables (xval and dummy respectively) that are placed on the stack.
If I remember correctly, the C++ specification does not require these local variables to have different addresses. This should not concern you either.
The address of those variables has meaning only within the function in which the variable is defined, so comparing the addresses accross two different functions is meaningless.
What technically happens under the hood is, the compiler has placed 7 on the stack in your main() function before calling foo1(). Then foo1() prints out the address of that variable in the stack.
When foo1() is finished, the variable is popped from the stack and then 11 is placed on the stack before calling foo2(). This accidentally has used the same memory address but you should not count on this. For example, if you call foo2() from within foo1() this would affect the stack and the address would be different. Try the following:
#include <stdio.h>
extern void foo2(int dummy);
void foo1(int xval)
{
int x;
x = xval;
printf("X Address == 0x%x, Value of x == %d\n", &xval, x);
foo2(11);
}
void foo2(int dummy)
{
int y = dummy;
printf("Y Address == 0x%x, Value of y == %d\n", &dummy, y);
}
int main()
{
foo1(7);
return 0;
}
In summary, do not try to analyze what the concrete address value is. Simply use the address without looking into it. This is platform and compiler dependent.