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;
}
The Size of a Given = 5

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.