In-place string literal subscripting

I confess, I had never occurred before to subscript a string literal in-place. For example:

#include <stdio.h>

int main() {
  int i;
  for (i = 0; i < 8; ++i)
    printf("%c", "12345678"[i]);
  printf("\n");
  return 0;
}

To me personally the expression "12345678"[i] cuts the eye. But from the language point of view everything is fine.


Original post | Disclaimer

Comments