I am a bit confused now. So, if i write the following code:
int x = 5;
cout << &x << endl;
compile it and run, I'll get something like 0x920FC7D
which is the normal hexadecimal value for memory locations. But when I compile and run the following code:
#include <iostream>
using namespace std;
void add(int a, int b){
cout << a + b << endl;
}
void subtract(int a, int b){
cout << a - b << endl;
}
void multiply(int a, int b){
cout << a * b << endl;
}
int main(){
void ( *operations[3] ) (int, int) = {add, subtract, multiply};
int length = sizeof(operations)/sizeof(operations[0]);
for(int i=0; i < length; ++i){
cout << operations[i] << endl;
}
return 1;
}
I always get:
1
1
1
It seems the address of pointer should also be hexadecimal value, but even if it's binary or just decimal, why it is always the same?