I did this test in C++ using G++ 4.8.1
#include <iostream>
void function(){
int q=0;
q++;
q=q-2;
}
int main ()
{
std::cout << (void*)&function;
return 0;
}
It gave me 0x4013e0
which is the correct address of my function.
The random numbers you've described to me seem to sound like the variable is uninitialized and has an unpredictable value. that is the initial value is not set and could be anything.
Assigning the address to a variable could be like this:
void* i = (void*)&function; # as a pointer.
int q = (int)i; # as integer value.