Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What does while(*p!='\0') mean?
What does while(*p!='\0') mean?

while (*p!='\0') means that when the displayed content is not empty, the code segment of the loop body is executed,

{

wr_dat( *p);

p++;

delay1ms(1);

}

Or it can be understood as judging whether the displayed content has reached the end .

'\0' is the string terminator, and 0 is an integer constant. Be careful not to confuse it with '\0'.

While is a basic loop mode of computers. When the condition is met, it enters the loop. After entering the loop, when the condition is not met, it exits the loop. The general expression of the while statement is: while (expression) {loop body}.

Extended information:

C++while statement example:

int?a=NULL;

while(a<10)

{

a++;//Self-adding

if(a>5)//Exit the loop without waiting for while, directly judge the loop

< p>{

break;//Jump out of the loop

}

}

Result: The value of a is 6 after the end.

Baidu Encyclopedia-while loop statement