top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Correct option to declare an array in C?

+3 votes
232 views

We can declare the array in the following two ways, I want to know what is the re-commanded way -

arr[]={1,2,3,4,5,6,7,8,9,10};
arr[10]={1,2,3,4,5,6,7,8,9,10};
posted Jul 5, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Both the option are same however preference is the first one as you leave it to the compiler for the size of the array which can avoid the unwanted mistake.

answer Jul 7, 2014 by Salil Agrawal
...