C Program to Find the Array Length

Write a C Program to Find the Array Length or size of an array. In the C language, we can use the sizeof operator to find the array’s size or length.

#include <stdio.h>

int main()
{
    int arr[] = {10, 20, 30, 40, 50, 60, 70};

    int num;

    num = sizeof(arr);
    
    printf("The Total Number of Array Items = %d", num);
    
    return 0;
}
C Program to Find the Array Length 1

The standard way to find the size or length of an array in C Programming is

#include <stdio.h>

int main()
{
    int arr[] = {15, 25, 35, 45, 55};

    int num;

    num = sizeof(arr)/ sizeof(arr[0]);
    
    printf("The Size of a Given Array = %d", num);
    
    return 0;
}
The Size of a Given Array = 5