sizes of arrays within functions
In C, i used a define when i first was learning which was something like:
or something along those lines in order to be able to figure out the length of integer arrays (char arrays are easier).
#define LENGTH(array) (sizeof(array)/sizeof(array))
I was just curious about passing integer arrays to functions either to read them or modify them, and if I can find out their length.
I was also curious as to the proper way to pass and integer array to a function. Can i pass it as int array if I want to read and modify it? Or should I be using int *array? If I use int *array will the LENGTH define even work? Thanks.
printf( "Length: %d", LENGTH(array) );
void foo( int array )
printf( "Length: %d, LENGTH(array) ); //does this work?