Here p is pointer to two dimensional array and when i tried to see its size i got the below answers ,but my question is a pointer is of 4 bytes right?

Viewed 16
enter code here
#include<iostream>
using namespace std;
int main()
{
    int (*p)[4];
    p =new int[3][4];
    cout<<endl<<sizeof(p)<<endl<<sizeof(*p);
}

Output: 8 16 //every pointer stores adress so it should be of int size i.e 4 in 32 bit and 8 in 64 bit // *p means its arrays 1st element which is of type int right ,so it should be of 4 or 8 bytes

0 Answers
Related