C Program to Find the Array Length

Write a C Program to Find the Array Length or size of it. In this C programming 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

The standard way to find the size or length of an array in this 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 = %d", num);
    
    return 0;
}
C Program to Find the Array Length 2