[c] printf \t option

When you are printing a tab character to the standard output using printf in C, it outputs some space which is apparently 4 characters in length.

printf("\t");

Is there any way by which I can control the tab width in the above case? Any help or suggestion is appreciated.

This question is related to c printf

The answer is


That's something controlled by your terminal, not by printf.

printf simply sends a \t to the output stream (which can be a tty, a file etc), it doesn't send a number of spaces.