Single Choice
Not Set
QWhat is right way to Initialize array?
ID: #1413
Array in C Language
20,330 views
Question Info
#1413Q ID
Not SetDifficulty
Array in C LanguageTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer
Explanation
Answer: Option A
Let us see how to initialize an array while declaring it. Following are a few examples that demonstrate this.
int roll[6] = { 2, 4, 12, 5, 45, 5 } ;
int array[ ] = { 2, 4, 12, 5, 45, 5 } ;
float points[ ] = { 12.3, 34.2 -23.4, -11.3 } ;
Learn more details about Single Dimensional Array in C Programming Language
Note the following points carefully:
(a) Till the array elements are not given any specific values, they are supposed to contain garbage values.
(b) If the array is initialized where it is declared, mentioning the dimension of the array is optional as in the 2nd example above
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic