I have a contrived example to demonstrate the request for a specific functionality - I wonder if anyone has a clever trick to do this.
The following is a problem one
"Brute force" and ternary condition solution have the same complexity, but the second one is less "readable".
You can do a simple method print:
void print() {
int i = 0;
for(i=0; i != size - 1; ++i) {
printf("%i ",i);
}
printf("%i\n", i);
}
I think it is efficient and readable too.
In this way you reduce cyclomatic complexity of your alghotitm.