C#错误 并非所有的代码路径都返回值

[复制链接]
查看11 | 回复4 | 2013-4-29 21:57:34 | 显示全部楼层 |阅读模式
else if (Key < ch[mid])
returnBinsch1(ch, low, mid - 1, Key); else
returnBinsch1(ch, mid + 1, high, Key);//没有返回值...
回复

使用道具 举报

千问 | 2013-4-29 21:57:34 | 显示全部楼层
区别在于return放在循环中而n大于nsqrt的时候循环不执行,所以没有返回值,导致报错。...
回复

使用道具 举报

千问 | 2013-4-29 21:57:34 | 显示全部楼层
少了return 如下:class Binsch
{
public intBinsch1(char[] ch,int low, int high, char Key)
{
if (low <= high)
{
int ...
回复

使用道具 举报

千问 | 2013-4-29 21:57:34 | 显示全部楼层
方法带有返回值却没有使用return关键字或者方法不带返回值却使用了return...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行