OJ 注意事项

1,检查指针是否有效,即是否为NULL

 1 void OutputMaxAndMin(int * pInputInteger, int InputNum, int * pMaxValue, int * pMaxNum, int * pMinValue, int * pMinNum)
 2 {
 3     /*在这里实现功能*/
 4         int i = 0;
 5     int num = 0;
 6     if (InputNum <= 0 || pInputInteger == NULL)
 7     {
 8         *pMaxNum =0;
 9         *pMinNum = 0;
10         *pMaxValue = 0;
11         *pMinValue = 0;
12         return;
13     }
14 
15     .....
16 }

 

posted @ 2014-12-26 15:51  soul390  阅读(192)  评论(0编辑  收藏  举报