Number of elements in float array in C -
i have array of float in c. length of array depends of user input. need find out number of elements in array. example:
float a[10] = {3.1314, 1.5131, 9.133, 10.333} how can check number of elements? sizeof(a)/sizeof(a[0]) give max number of elements (10 in case).
the number of elements in array of type t[n] n definition. array, of type float[10], has 10 elements, first 4 set values, rest set 0.0f. if want check how many elements have been set, you'll have set rest sentinel value not valid value "set". or can keep track of number of set elements separately.
Comments
Post a Comment