-1

What will be the output of the following programs:

    #include <stdio.h>
    int main()
    {
        printf("ab\tab\tab\ba");
        return 0;
    }
  • 2
    Why can you not run the code yourself and see? Apart from that, the title of your Question doesn't make it easy to find in a search. – Scratte Sep 03 '20 at 06:18
  • 3
    I’m voting to close this question because it says "What will be the output of the below mentioned C problem?". There is not issue with code but OP just want to know output. – Karan Sep 03 '20 at 06:26
  • You can use [Ideone](https://ideone.com/mWVhep) – mpromonet Sep 03 '20 at 06:49

1 Answers1

1

The result would be ab ab aa. This is because the string contains certain characters("ab \t ab \t ab \b a") that the program will detect. \t(This is tab, It will usually add four spaces in its spot) and \b( means backspace, so it will delete the previous character in the string).

ChilliPenguin
  • 710
  • 7
  • 14
  • #include int main() { printf("ab\tabc\tabcda"); return 0; } output is: ab abc abcda ,,,, I am not getting why the space in between the ouptut is not of uniform width. – Rahul Singh Sep 02 '20 at 21:58
  • Did you post the exact message you receive? If so, that is a bit strange, however it might be related to [this](https://stackoverflow.com/questions/19447255/tabs-in-string-have-different-size) and [this](https://stackoverflow.com/questions/6646039/printf-t-option). It probably is a terminal issue, and not the code itself. – ChilliPenguin Sep 02 '20 at 22:15