大龙的博客

常用链接

统计

最新评论

C/C++中利用空指针简化代码,提高效率 ----- 转

#include <iostream>   
#include <string>   
using namespace std;   
   
void print_char(char* array[]);//函数原形声明   
   
void main(void)     
{     
    char* test[]=;//这里添加一个NULL,表示不指向任何地址,值为0   
    print_char(test);   
    cin.get();   
}   
   
void print_char(char* array[])   
{   
    while(*array!=NULL)   
    {   
        cout<<*array++<<endl;   
    }   


自己的理解为:
注:如果用for循环,那么里面有循环变量,要经过读,改,写.

posted on 2008-11-08 10:50 大龙 阅读(498) 评论(1)  编辑 收藏 引用

评论

# re: C/C++中利用空指针简化代码,提高效率 ----- 转 2008-11-09 09:32 空明流转

这个叫“哨兵”  回复  更多评论   


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理