Arrays (cont)
Assuming an array declaration like Type v[ N ] ...
- individual array elements are accessed via indices 0..N-1
- total amount of space allocated to array N ×
sizeof( Type )
- array name gives address of first element (e.g.
v = &v[0] )
- array indexing can be treated as
v[i] ≅ *(v+i)
Strings are just arrays of char with a '\0' terminator
- constant strings have
'\0' added automatically
- string buffers must allow for element to hold
'\0'
|