No. buffer is char * . This is a pointer to char data. A pointer takes up only 4 bytes (on your system).
It points to 10,240 bytes of data (which, by the way, is not 1Kb. More like 10Kb), but the pointer does not know this. Consider:
int a1[3] = {0, 1, 2}; int a2[5] = {0, 1, 2, 3, 4}; int *p = a1;
This is the main difference between arrays and pointers. If this does not work, sizeof p will change in the above code, which does not make sense for the compile-time constant.
Chris Lutz Apr 28 2018-10-18T00: 00Z
source share