Jump to content

Gotchas: Difference between revisions

m
Line 170:
<syntaxhighlight lang="C">int foo[4] = {4,8,12,16};</syntaxhighlight>
 
However, arrays are zero-indexed, so in your code you'll never actually want to read from/write thatto the same subscript used when declaring the array. Doing so indexes the array out of bounds, reading from or writing to the address of whatever happens to be stored in memory after it.
 
Chances are this will compile even though it's not something you really want to have happen.
1,489

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.