Is it acceptable to have a post/prefix operator on the lhs of an assignment operator?
#include<ctype.h>
void to_upper_in_place(char* string)
{
while(*string++ = toupper(*string));
}
If it is OK, is the previous considered readable C code, or should it be turned into something like the following?
#include<ctype.h>
void to_upper_in_place(char* string)
{
while(*string) {
*string = toupper(*string);
string++;
}
}
Or even:
while(*string = toupper(*string++));