C and C++ USES null Pointers to simplify code and improve efficiency
- 2020-05-05 11:09:41
- OfStack
The way you write it here avoids the for loop, reduces the memory usage of the stack space and reduces the computational overhead at run time!
#include iostream>
#include string>
using namespace std;
void print_char(char* array[]); // the function prototype declares
void main(void)
{
char* test[]={" abc cde ", ""," fgh ", NULL & # 125;; // here we add an NULL, which means that we do not point to any address, and the value is 0
print_char(test);
cin.get();
}
void print_char(char* array[])
{
while(*array!=NULL)
{
cout