Count Array elements using sizeof() operator.

C program to count Array elements by using sizeof() operator.

Program

#include<stdio.h>
#include<conio.h>
#define MAX 50

void main()
{
	int arr[] = {1,2,3,4,5,6,7,8};
    int size;

    size = sizeof(arr)/sizeof(arr[0]);

    printf("Size of the array is\t:%d",size);
    getch();
}

Output

Size of the array is    :8