Suppose I declared an array as following:
int myArr = [someSize];
Now I put n elements (where n is not known exactly but n < someSize) in it like this
myArray[0] = 12;
myArray[1] = 23;
and so on .....
Now I want to know is there any way to find out exactly how many elements have been entered by the user.
If you know that there is some value that can’t be put into the array (i.e. it is checked and disallowed beforehand), then you can initialise every element of the array to that, and then just do a count. e.g. if the array is initialised to
-1: