0
int **p;
p = malloc (x * sizeof *p);

sizeof *p - (i am not quite sure, and i was thinking) does it calculate the size of *p as size of double pointer, size of pointer or as size of variable pointed by pointer

another exmaple with same int **p;

p[n] = malloc (y * sizeof *p[n]);

*p[n] - size of pointer or size of variable pointed by pointer

i think i asked this before somewhere, or wanted to...but didnt want to bother the person who gave me all answers on all other questions, and thread was marked as solved also...

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by nucleon
0

sizeof p gives the size of an int**.
sizeof *p gives the size of an int*.
sizeof **p gives the size of an int.
sizeof *p[n] also gives the size of an int.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.