www.thecareerplus.com
The CareerPlus
Home Technical Resources Programming Arrays and Pointers
Wednesday 08th September 2010
 
 
How can we find out the length of an array dynamically in C?

Discuss it!          

Here is a C program to do the same...


#include <stdio.h>
#include <conio.h>

int main()
{
  int arr[] = {3,4,65,78,1,2,4};
  int arr_length = sizeof(arr)/sizeof(arr[0]); 
  
  printf("\nLength of the array is :[%d]\n\n", arr_length);
  
  getch();
  return(0);
}

Discuss it!          

CrackTheIntervew.NET
Advertisement
 
Top! Top!