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++

零下一度
Release: 2017-07-03 17:14:15
Original
1905 people have browsed it


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
    }    
}
Copy after login


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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template