比如說:
①除以零②數(shù)組越界:int a[3]; a[10000000]=10;③指針越界:int * p; p=(int *)malloc(5 * sizeof(int)); *(p+1000000)=10;④使用已經(jīng)釋放的空間:int * p; p=(int *)malloc(5 * sizeof(int));free(p); *p=10;⑤數(shù)組開得太大,超出了棧的范圍,造成棧溢出:int a[100000000];一般來說,在oj上做題都把數(shù)組設(shè)成全局變量,減少5出現(xiàn)的可能。
有的時(shí)候再出現(xiàn)這樣的錯(cuò)誤還會(huì)給提示Runtime Error(ARRAY_BOUNDS_EXCEEDED) // array bounds exceed 數(shù)組越界Runtime Error(DIVIDE_BY_ZERO) //divisor is nil 除零Runtime Error(access_VIOLATION) //illegal memory access 非法內(nèi)存讀取Runtime Error(STACK_OVERFLOW) //stack overflow 系統(tǒng)棧過載這樣可以照著上面查找錯(cuò)誤。
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注