|
|
|
|
|
by jylam
987 days ago
|
|
It always startles me when the first (actually the second) example is bad: int do_indexing(int *buf, const size_t bufsize, size_t index) {
if(index < bufsize)
return buf[index];
return -1;
}
buf[index] can hold the value -1, as buf holds signed ints, so that (corrected, by the author) function is totally wrong anyway. |
|