03-23-2011 12:06 PM
Hi,
Are double arrays able to contain null values? Also, what is the double array equivalent to strlen( )?
Sorry for the noobish questions!
Thanks
Solved! Go to Solution.
03-23-2011 12:18 PM
Hi,
If you mean NULL, remember that NULL is defined as ((void *)0), i.e. a pointer.
If you want to obtain the size of an array, you can use sizeof ( array ) / sizeof ( double ).
Hth,
Wolfgang
03-23-2011 12:29 PM
Or more generically
sizeof(array)/sizeof(array[0]);
05-23-2011 02:12 PM
My apologies, that is very helpful, but what I meant to ask is how would I query the amount of elements in a double array?
for example:
double rhoArray[]={.118,.040,.025,.014,.007,.005,.004,.003,.002,.002,.003,.005,.012,.016,.020,.023,.021,.020}; numElements = strlen(rhoArray);
05-23-2011 02:17 PM
I'm not sure what you're asking.
sizeof(array) tells you how much space the entire array takes.
sizeof(array[0]) tells you how much space one array element takes.
sizeof(array) / sizeof(array[0]) tells you how many elements are in the array.
Anything else?
07-11-2016 01:20 PM - edited 07-11-2016 01:28 PM
}