do
The do...while construct provides an iterative loop. Use it in conjunction with the while keyword.
do statement... while( expression );
statement is executed repeatedly as long as expression is true. The test on expression takes place after each execution of statement.
Example
The following example uses a do-while statement to loop through a string, str, in search of the first non-numeric character.
int is_digit, i = 0;
char * str = "1234567k89";
int len = strlen(str);
do {
if (i == len) {
lr_output_message ("No letters found in string");
return -1;
}
is_digit = isdigit(str[i++]);
} while (is_digit);
lr_output_message ("The first letter appears in character %d of str", i);Example: Output:
Action.c(18): The first letter appears in character 8 of str

