OiO.lk Blog C++ C programming weird behaviour of “\t” (newtab)
C++

C programming weird behaviour of “\t” (newtab)


so I’ve come across a weird scenario.

When running this code:

#include<stdio.h>

main(){
    printf("Fahrenheit\tCelsius\n");
    printf("Celsius\tFahrenheit\n");

}

it will show

Fahrenheit      Celsius
Celsius Fahrenheit

Can somebody explain why is the \t behaving like this?

Instead of:

Celsius Fahrenheit

it should show:

Celsius      Fahrenheit



You need to sign in to view this answers

Exit mobile version