I have an array like this:
int a[100];
I am filling only the first 4 elements in this array:
a[0] = 1;
a[1] = 2;
a[2] = 3;
a[3] = 4;
When I do sizeof(a)/sizeof(a[0])
it returns 100.
Is there a way I can get number of elements to which I have assinged a value and thus filtering out the remaining 96 unassigned elements?
thanks
No. Nothing keeps track of that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With