Final answer:
The illegal declarations are (b) int size = 3; int array[size]; and (c) int size = 3; int array[size] = (1, 2, 3);
Step-by-step explanation:
The illegal declarations are (b) int size = 3; int array[size]; and (c) int size = 3; int array[size] = (1, 2, 3);
- In declaration (b), the size of the array is determined by the variable 'size', which is not a constant. Array sizes must be constants in C++.
- In declaration (c), the syntax used to initialize the array is incorrect. To initialize an array, each value should be enclosed in curly braces {}.
Therefore, the correct answer is (d) All declarations are legal.