Advertisements
Advertisements
प्रश्न
Given:
int a[ ] = new int [5];//declaration of array
a[3]=5;
The code will generate ______.
विकल्प
no error
logical error
syntax error
runtime error
MCQ
रिक्त स्थान भरें
Advertisements
उत्तर
The code will generate no error.
Explanation:
Declaring an array of size 5 creates valid slots from indices 0 to 4. Assigning a value to a[3] is perfectly safe because index 3 falls completely within this legal range.
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 7: Arrays - One Dimension - Exercises [पृष्ठ १७२]
