which of the following statement is correct? int num[7]; int num[7]=8;
Answers
Answer:
into num (7)
Explanation:
is correct
In both statements 7 specifies array size, technically both of the statements are correct.
Explanation:
This is an array. An array declaration is similar to the form of a normal declaration (typeName variableName), but we add on a size:
typeName variableName[size];
This declares an array with the specified size, named variableName, of type typeName. The array is indexed from 0 to size-1. The size (in brackets) must be an integer literal or a constant variable. The compiler uses the size to determine how much space to allocate (i.e. how many bytes).
Examples:
int list[30]; // an array of 30 integers
char name[20]; // an array of 20 characters
double nums[50]; // an array of 50 decimals
int table[5][10]; // a two dimensional array of integers
The last example illustrates a two dimensional array (which we often like to think about as a table). We usually think of the first size as rows, and the second as columns, but it really does not matter, as long as you are consistent.
To know more:
- Hello... what is array?
https://brainly.in/question/5387851
- What is array? Explain need for array.
https://brainly.in/question/8457756