Home >Backend Development >C#.Net Tutorial >Using null pointers to simplify code examples in C/C++

Using null pointers to simplify code examples in C/C++

零下一度
零下一度Original
2017-07-03 17:14:151881browse


reduce the use of stack space memory and reduce the calculation overhead during runtime!

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


The above is the detailed content of Using null pointers to simplify code examples in C/C++. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn