Discussion
Which of the following statements are correct about an array?
1. The array int num[26]; can store 26 elements.
2. The expression num[1] designates the very first element in the array.
3. It is necessary to initialize the array at the time of declaration.
4. The declaration num[SIZE] is allowed if SIZE is a macro.
Answer: B
Correct answer: 1,4
1 is true - int num[26]; holds 26 elements, with subscripts 0 to 25. 4 is true - a macro expands before compilation, so num[SIZE] is a constant bound. 2 is false: num[1] is the second element, since indexing starts at 0. 3 is false: an array need not be initialised at declaration, though an uninitialised automatic array holds junk.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development