No out of bounds error

后端 未结 7 621
既然无缘
既然无缘 2020-11-22 01:01

I have this code in C which takes in bunch of chars

#include 
# define NEWLINE \'\\n\'
int main()
{

char c;
char str[6];
int i =         


        
7条回答
  •  有刺的猬
    2020-11-22 01:31

    C does not check array bounds.

    In fact, a segmentation fault isn't specifically a runtime error generated by exceeding the array bounds. Rather, it is a result of memory protection that is provided by the operating system. It occurs when your process tries to access memory that does not belong to it, or if it tries to access a memory address that doesn't exist.

提交回复
热议问题