Discussion
Consider the statement
int val[2] [4] = { 1, 2, 3, 4, 5, 6, 7, 8} ;
4 will be the value of
Answer: A
Correct answer: val[0 ][ 3]
A brace-list without inner braces fills a two-dimensional array row by row. With 4 columns, the first row takes 1, 2, 3, 4 and the second 5, 6, 7, 8. The value 4 is therefore the fourth element of row 0, that is val[0][3]. val[0][4] is out of bounds, and val[1][1] is 6.
No comment is present. Be the first to comment.
Loading…
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