The code is as follows and I wanted to know more about how and where \v and \f are used?

printf("Vertical tab \v is tricky, as its behaviour is unspecified under certain conditions.\n");

Also, can anyone explain what the sentence in the print statement suggests?

Recommended Answers

All 2 Replies

Vertical tab and form feed are exactly what you'd think, and they really only apply to things like line printers or ancient hardcopy terminals. Note that those were part of the language way back in the 60s where such things were far more common than now. You're not likely to use either of them in modern code.

Concerning vertical tab, the standard says that the following is unspecified:

The behavior of the display device if a vertical tab character is written when the active position is at or past the last defined vertical tabulation position (5.2.2).

However, and this is important to recognize: horizontal tab has the same unspecified behavior:

The behavior of the display device if a horizontal tab character is written when the active position is at or past the last defined horizontal tabulation position (5.2.2).

Notice how the wording is identical with the only difference being an exchange of "vertical" with "horizontal". Essentially the same wording is used for printing any character at the end of a line, backspace, horizontal tab, and vertical tab. Ultimately this implies that the behavior is unspecified if you produce any output at all. :D In other words, don't worry about it.

commented: Ok thnx :) +0

While \v is something I've never used, I have used \f. On output it will generally form feed, kicking out the page when encountered. It's the code that is used when you do a page break in your word processor.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.