Hi all, need some help in understanding the following.
In the following C code, pString is a normal character string ended with null and is passed as pointer into the SendString function, which extracts one byte and calls the SerialOut_To_PC function.
How does the FOR loop inside the SendString function knows when to stop? Or how to interpret *a as an ending condition?
In the following C code, pString is a normal character string ended with null and is passed as pointer into the SendString function, which extracts one byte and calls the SerialOut_To_PC function.
How does the FOR loop inside the SendString function knows when to stop? Or how to interpret *a as an ending condition?
Rich (BB code):
//*******************************
// RS232 Send string (unsigned)
//*******************************
void SendString(unsigned char* pString)
{
unsigned char *a;
for(a=pString;*a;a++)
SerialOut_To_PC(*a);
}
// This is how the SendString is called to send the string in quotes
SendString("ABCDE_MNOPQ\0");
Last edited: