sizeof(pointer) on 64 bit OS

Hello,

I have a 64 bit windows operating system. When i try to find the sizeof() a pointer, i always get '4'. Should it not be '8' for a 64 bit system? Is my compiler effecting the output of sizeof() call? If yes, can i change its settings?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

#include <iostream>
using namespace std;

size_t getPtrSize( char * ptr )
{
   return sizeof( ptr );
}

int main(int argc, char *argv[])
{
    double d;
    double * ptr = &d;

    cout<<"size of pointer is :"<< sizeof(ptr)<<endl;

    return 0;
}
Your application is built as a 32-bit application most likely. In VC++, you have to explicitly build the application as a 64-bit application, it doesn't default to it.
O.K. thanks for your reply.
Topic archived. No new replies allowed.