I was just curious to know how to find the number of elements of an array of integers. For character arrays we can loop thorough the array till we reach the null character,but how can I do it for integer array?
#include <iostream.h>
void main()
{
int a[] = {1,2,3,4};
for ( k = 0 ; a[k] ; k++)
cout<<k<<endl;
}
The above code counts from 0 to 8.
-A C++ noob with an open mind