Is it possible to use a function to detect non-printing characters with isctrl() and use printf with %C specifier to print them as ‘\n’ for instance?
Or I should write an if for every control caracter and printf("\\n") for instance..?
OK, thanks to All of the kind people below – it is not posible, you HAVE to specify each situation. example:
if (isctrl(char))// WRONG
printf("%c", char);
if (char == '\n')//RIGHT, or using switch.
printf("\\n");
To expand on the answer by Aniket, you could use a combination of
isprintand the switch-statement solution: