When you have to walk a string you can walk the pointer instead of incrementing the index.
Code :
#include <stdio.h>// print each charvoid f(char* s) { for (int i=0;s[i];i++) putchar(s[i]);}// same output than f;void g(char* s){ for (;*s;) putchar(*s++);}int main(void) { f("hello\n"); g("hello\n"); return 0;}
example: Remove duplicated & switched case