Accessing out-of-bounds elements of dynamically allocated arrays / w/o SegFault

前端 未结 4 2063
粉色の甜心
粉色の甜心 2021-01-24 18:48

I\'m developing a program in C that uses an array of linked lists (a primitive hash table) as a data type to represent certain date information. The array has twelve elements c

4条回答
  •  一整个雨季
    2021-01-24 19:23

    Could anybody explain why accessing out-of-bounds elements would not result in a segfault?

    This is Undefined Behaviour, it does not have to segfault. On Linux you can run your program under Valgrind to catch this kind of errors.

提交回复
热议问题