Q. Write a C program to calculate the length of a given array.
arr[] = {12, 7 , 9 , 4 , 22 , 63 , 74 , 5 , 1 }
Ans.
/*c program for calculate the length of array*/
#include<stdio.h>
int main()
{
int arr[]={ 12,7,9,4,22,63,74,5,1 };
int length;
length = sizeof(arr)/sizeof(int);
printf("Length of given array = %d",length);
getch();
return 0;
}
/*************** Output *****************/
Related programs:
arr[] = {12, 7 , 9 , 4 , 22 , 63 , 74 , 5 , 1 }
Ans.
/*c program for calculate the length of array*/
#include<stdio.h>
int main()
{
int arr[]={ 12,7,9,4,22,63,74,5,1 };
int length;
length = sizeof(arr)/sizeof(int);
printf("Length of given array = %d",length);
getch();
return 0;
}
/*************** Output *****************/
Screen shot for calculate length of array c program |
Related programs:
0 komentar:
Posting Komentar