October 22, 2024
Chicago 12, Melborne City, USA
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

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video