Size of array in C

   #include <stdio.h> 
   #define N 5 /* Size of array */ 
   main( ) 
   { 
      int A[N]; /* Space for A[0].........A[4] is allocated */ 
      int j,sum=0; 
      for(i=0; i<N; i++) A[i]=i*i; /* Initialize the array */ 
      for(i=0;i<N; i++) /* Display array elements */ 
         printf(“ A[%d]=%d”, i, A [i] ); 
         for(i =0; i <N; ++i) /* Find total */ 
		 sum + = A[i]; 
		 printf (“ \n sum=%dn/n”, sum); 
	 return; 
	 }

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.