C printf \t - not performed

C printf \t - not performed

by Christian Gasde -
Number of replies: 2

Hi Richard,

at the first glance the following looks good:

Coderunner c \t ist not performed

BUT:
Why is \t within the printf-statement not performed?

I would expect something like:

Online GDB output...

Thankx for any help!

Best regards from Coburg!
Chris

In reply to Christian Gasde

Re: C printf \t - not performed

by Richard Lobb -
The ASCII tab character is defined to move the cursor to the next tab stop. But ... where are the tab stops? In a Linux terminal they are every 8 characters. In typical code editors they're normally every 4 characters but the spacing can usually be set by the editor preferences. In word processing they're wherever the user sets them. Since CodeRunner questions are in multiple languages and in multiple problem domains, there is no well-defined way to format the output to match every user's expectations. 

A further problem is in defining the correctness. Would you want to accept "abc\t" and "abc" followed by 5 spaces as equivalent? Probably yes in some circumstances, no in others. And if "no", how would the error be conveyed to the student, given that the two outputs appear identical?

Similar problems arise with backspace. Is "abd\bc" equal to "abc"? Always?

So ... CodeRunner displays just what the program printed (mostly) and the expected and got fields have to match exactly.
In reply to Richard Lobb

Re: C printf \t - not performed

by Christian Gasde -
Hi Richard,

thank you again for your descriptive answer!

I our usecase we want to tabulate the results from some binary operations - in order to visualize the correct output.

We will adjust the testcases in such a way that we don't need the '\t' function.

Best Regards from Coburg
Chris