How to find the length of Array in C_Language

sizeof(): is used to get the data type size in C language.

#include<stdio.h> #include<stdlib.h> int main() { int arr[] = {1,2,3,4,5,6}; int length = sizeof(arr)/sizeof(int); //length of an integer array printf("Array length = %d",length); }

agyanadda

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

0 $type={blogger}:

Post a Comment