首页 > 其他 > 详细

re|runtime error 错误原因之三

时间:2021-07-11 17:50:00      阅读:17      评论:0      收藏:0      [点我收藏+]

1、数组太小,下标超界。

int k=100,a[10];

cout<<a[k];

更正:int a[1000];


2、递归过多,爆栈空间。

int digui(int t){

  return digui(t+1);

}

更正:

int digui(int t){

  if(t>10)return t;

  return digui(t+1);

}


3、函数没有返回值。

int test(int t){

  t=t+10;

}

更正:

int test(int t){

  t=t+10;

  return 0;或者 return t;

}

re|runtime error 错误原因之三

原文:https://www.cnblogs.com/cosmowind/p/14998759.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!