首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

请前辈帮小弟我看看小弟我的这三个有关问题,非常感谢

2012-03-05 
请前辈帮我看看我的这三个问题,非常感谢!/*Function:cardtableindex取得处理*//*Input:slotnosolt序号*//

请前辈帮我看看我的这三个问题,非常感谢!
/*   Function   :   card   table   index   取得处理                 */
/*   Input         :   slotno   =   solt   序号                               */
/*   Output       :   *index   =   card   index                             */
/*   Return       :   OK   =   正常应答                                         */
/*                     :   NG   =   没有安装                                         */

UCHAR   getindex_card(UCHAR   slotno,   UCHAR   *index)
{     UCHAR           cardno;
      for(cardno   =   0;   cardno   <   max;   cardno++){
                if(slotno   ==   card_table[cardno].slot_no){
                        *index   =   cardno;
                        return   OK;
                }
        }
      return   NG;
}
请问1:这个程序段上面注释中的   output   和   return   有什么区别?
请问2:getindex_card()里面明明有两个参数,为什么前面的注释中input   只写了一个?第二个参数*index   在开始调用次函数时,不需要为其附一个值么?
请问3:   这里的index   值得是什么?程序里面,一般用index代表什么含义?


[解决办法]
第一个问题,没看懂!
第二个问题,注释程序只是个人的习惯,有的人从不注释,有的人写一点注释,有的人写大段的注释,纯属习惯问题。
第三个问题,index是一个指针,其值是个地址值(具体是多少,用cout < <index < <endl输出看看),一般程序中index都表示下标。

热点排行