C 语言查找数组长度的程序

编写一个 C 语言程序来查找数组的长度或大小。在该编程语言中,我们可以使用 sizeof 运算符来查找数组的大小或长度。

#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;
}
Program to Find the Array Length

在此编程语言中查找数组大小或长度的标准方法是

#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