int main()
{
int array[10] = {0};
printf("%ul\n", (unsigned long)sizeof array);
return 0;
}
And if you don't want the size of the array (in bytes) but the number
of its elements use
sizeof array / sizeof array[0]
Please note that this only works when array is a real array, not a
pointer to an array that got e.g. passed to a function, if you need
the size of an array within a function you must pass its size to the
function beside the pointer to the array.
Arrays do not have parameters, but functions do. You can determine
how many each has by counting them when you create them.
But if you should mean the number of command line arguments you need
int main( int argc, char *argv[] )
and then 'argc' ist the number of arguments (including the name the
program was called with, which is argv[0]).
Regards, Jens
--
_ _____ _____
| ||_ _||_ _| (e-mail address removed)-berlin.de
_ | | | | | |
| |_| | | | | |
http://www.physik.fu-berlin.de/~toerring
\___/ens|_|homs|_|oerring