Which of the following statement(s) is/are correct ?
int num[7];
num[7]=8;
a) In the first statement 7 specifies a particular element, whereas in the second statement it specifies a type;
b) In the first statement 7 specifies a particular element, whereas in the second statement it specifies the array size.
c) In the first statement 7 specifies the array size, whereas in the second statement it specifies a particular element of array.
d) In both the statement 7 specifies array size.
Answers
Answer is :
In the first statement 7 specifies the array size,
whereas in the second statement it specifies a particular element of array.
Explanation :
Given code is :
int num[7];
num[7]=8;
- Here, int num[7]; is the declaration of an array named num, with its type 'int' and of size 7.
- It is a static declaration.
- While, in num[7]=8;, 7 represents the index of the array num.
- To the position 8 or index 7, the value 8 is assigned in the array num.
- Always remember, indexing starts from 0 and ends at n-1.
Learn more :
1. How to multiply two arrays and store the digits in array c++ gfg
https://brainly.in/question/10143912
2. WAP TO STORE 10 NUMBERS IN A ARRAY A[] ABD 5 NUMBERS IN A ARRAY B[] AND THEN MERGE INTO ARRAY C []
https://brainly.in/question/16360859
Which of the following statement(s) is/are correct ?
int num[7];
num[7]=8;
a) In the first statement 7 specifies a particular element, whereas in the second statement it specifies a type;
b) In the first statement 7 specifies a particular element, whereas in the second statement it specifies the array size.
c) In the first statement 7 specifies the array size, whereas in the second statement it specifies a particular element of array.
d) In both the statement 7 specifies array size.
Explanation:
The answer is
c) In the first statement 7 specifies the array size, whereas in the second statement it specifies a particular element of array.