C number of elements in array macro
array The name of an array. Return Value. The number of elements in the array, expressed as a sizet. Remarks. countof is implemented as a functionlike preprocessor macro. The C version has extra template machinery to detect at compile time if a pointer is passed instead of a statically declared array.Jun 17, 2005 I'm programming VBA in Excel 2003. I wish to index through a loop for each element in an array. But I need to refer to the elements by their index number, not their value as a string. How can I find the number of elements in an array of strings? Thanks. c number of elements in array macro
The above will not print 4711; the array's size is not part of the const int type that the array decays to in the function call. It's not in general possible to do this in C, i. e. find the size of an array that has been passed to a function accepting a pointer.