Chapter - 9: Arrays

Are the following array declarations correct?


C
Sections
2
Exercises

A

B

C

D

E

F

G

H

I

J

K

L

1

2

3

4

5

int a (25) ;
int size = 10, b[size] ;
int c = {0,1,2} ; 

Ans:
1. No: Array index is comes inside [ ].
2. No: Array index must have a constant, here size is a variable.
3. No: c is an int, and it cannot contain an array.


© 2020 Garbage Valuegarbage value logo