Send
Close Add comments:
(status displays here)
Got it! This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website. nbsp; Note: This appears on each machine/browser from which this site is accessed.
Array diagrams
c
go
java
js
lua
py
vbs
rkt
scm
pro
1. Array diagrams
2. Array diagram
Here is an array called
a that has
5 elements of type
int .
The declaration is as follows.
int a[5];
Note: Element indices start at
0 and end at
4 .
3. Another array
Here is an array called
b that has
6 elements of type
int .
The declaration is as follows.
int b[6];
Note: Element indices start at
0 and end at
5 .
4. Another array
Here is an array called
c that has
3 elements of type
int .
The declaration is as follows.
int c[3];
Note: Element indices start at
0 and end at
2 .
5. Initialized array
Here is an initialized array called
p that has
4 elements of type
int .
The declaration with initialization values as literals is as follows.
int p[4] = {2, 3, 5, 7} ;
Note: Element indices start at
0 and end at
3 .
This array literal declaration is the same as the following code.
6. End of page