Runtime error

Hi,
Can taking an array of size 1000 result in runtime error?
Also how much is the memory limit for questions in general as it is not specified?
Thanks.

Hey, i guess you have a wrong notion about runtime error. Runtime errors are of 3 types mainly :- SIGSEGV - This is caused when you use an undeclared portion of memory in your program. For example - U create an array of say 10000 and then somewhere in your program you unknowingly go ti a[10003]. This will give you a runtime error. As you have only declared 0 to 9999 indexed memory and using 10003.

2.) SIGFPE - This is a floating point error, generally caused when you are unknowingly dividing by zero in something. It is undefined and hence, the behaviour.

3.) SIGABRT - This is an abrupt termination of a program. For eg:- if u call abort() somewhere.

These are the three main types. However there are more which you will rarely find. For details u can refer to http://en.cppreference.com/w/c/program/SIG_types . So just creating an array of any size ownt cause you a runtime. But accessing an index out of your declared index will.

1 Like
//