4 ms·
Your second point depends, in fact, on whether buffer was allocated statically.
by dancsi 11y ago
Your second point depends, in fact, on whether buffer was allocated statically.
- mpweiher 11y agoEr, no. #include <stdio.h> static char buffer[80]; static char *bufferp=buffer; int main(int argc, char *argv[] ) { char localbuffer[80]; char *localbufferp=localbuffer; printf("buffer: %ld\n",sizeof buffer); printf("bufferp: %ld\n",sizeof bufferp); printf("localbuffer: %ld\n",sizeof localbuffer); printf("localbufferp: %ld\n",sizeof localbufferp); } Output: marcel@sarek[tmp]./a.out buffer: 80 bufferp: 8 localbuffer: 80 localbufferp: 8 As you can see, it depends entirely on whether you give sizeof the array or the pointer.