Size of pointer of integer type vs Size of int*

后端 未结 2 1433
心在旅途
心在旅途 2021-01-03 01:13

I started reading Pointers and while tinkering with them. I stumbled upon this :

#include
int main()
{
    int *p,a;
    a=sizeof(*p);
    pri         


        
2条回答
  •  无人及你
    2021-01-03 01:29

    *p and int* are not the same things! First one is a dereferenced pointer (i.e. int which is 4 bytes wide) and the second one is a pointer (8 bytes wide in your case since it's a 64 bit machine).

提交回复
热议问题