When do you use "if ( a = b )"? (was Re: Funny mistake)

Eric Bardes eric at cinnet.com
Wed Mar 20 07:32:42 AEST 1991


A typical usage, though slightly more hidden, of ( a = b ) in a conditional
expression would be this:

	char *a, *b;

	while (*a++ = *b++)   /* empty */ ;

This example copies from string b to string a include the null character.
Note the while loop has no body.

Eric



More information about the Comp.lang.c mailing list