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.
A.1
B.43104
C.43134
D.43135
Answers
Answered by
2
Hii dear here is your answer
option b is the correct answer
Hope its help u
option b is the correct answer
Hope its help u
Answered by
0
Answer:
1. The array int num[26]; can store 26 elements.
4. The declaration num[SIZE] is allowed if SIZE is a macro.
Explanation:
- int num[26] this statement states that name of the array is num which can store 26 integer values.
- The very first element of this array should be denoted by num[0] as the array indexing starts at 0.
- It is not necessary to initialize the array at the time of declaration. One can initialize array using loop.
- when we define a macro then that macro name is replaced by the value of that macro . so, if SIZE is a macro and we declare num[SIZE] , then SIZE will be replaced by its value.
#include<stdio.h>
#define SIZE 5
int main()
{
int num[SIZE], i;
printf("Enter a number\n", SIZE);
for(i = 0; i < N; i++)
{ scanf("%d", &num[i]);
}
printf("Array elements are:\n");
for(i = 0; i < SIZE; i++)
printf("%d\n", num[i]);
return 0;
}
Similar questions
Social Sciences,
7 months ago
Math,
7 months ago
Math,
7 months ago
Computer Science,
1 year ago
Computer Science,
1 year ago
Physics,
1 year ago
Biology,
1 year ago
English,
1 year ago