11. C program to print the number of elements present in an arrayArrays in C are declared as "sizeof" operator gives the size of the array in bytes so, to get the length of the array we divide the size of the array with the size of the first element. In this program, we need to count and print the number of elements present in the array. A number of elements present in the array can be found by calculating the length of the array. Length of above array is 5. Hence, the number of elements present in the array is 5. ALGORITHM:
PROGRAM:Output: Number of elements present in given array: 5
Next TopicC Programs
|