sizeof(x)
sets the number of bytes used by the array x.
sizeof(p_x)
sets the number of bytes used by the pointer.
#include<stdio.h>
int main() {
int x[10], *p_x;
printf ("%lu %lu\n", (unsigned long)sizeof(x), (unsigned long)sizeof(p_x));
return 0;
}
Program output:
40 4
My MSVC uses 32 bit pointers and 32 bit ints.
EDIT improved number formatting, following below, thanks.
source
share