Hi,
this is a bit tricky, but it is the way it works.
In case you still have doubts, enjoy that C program. You will never reach the memset:
#include <assert.h>
#include <string.h>
void test_sizeof(unsigned long test[4], char c) {
assert(sizeof(test) == (4 * sizeof(unsigned long)));
memset(test, c, sizeof(test));
}
void main() {
unsigned long tab[4];
test_sizeof(tab, '?');
}
Regards,
P. Schweitzer
Hey,
Yes, array arguments are just simple pointers in C, so sizeof will
return the size of a pointer to the base type.
Exercise for the reader: Predict what happens when you try passing an
int[4] into an int[8] argument.
WBR,
Roel Messiant