What does 'advance to the next page' mean in a printf statement?

  • Thread starter Thread starter Math Is Hard
  • Start date Start date
  • Tags Tags
    Program
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
7 replies · 3K views
Staff Emeritus
Science Advisor
Gold Member
Messages
4,663
Reaction score
36
Hi all,

I am working on one of my first assignments for my C class. My teacher gave the following instructions:

Write a printf statement that outputs the phrase "To be continued" and then advances to the next page.

I am completely confused by what he means by "advance to the next page"? Is that like going to a new line? I thought I would ask y'all first before I email him in case it's something completely obvious.

thanks!
 
Physics news on Phys.org
Math Is Hard said:
Hi all,

I am working on one of my first assignments for my C class. My teacher gave the following instructions:

Write a printf statement that outputs the phrase "To be continued" and then advances to the next page.

I am completely confused by what he means by "advance to the next page"? Is that like going to a new line? I thought I would ask y'all first before I email him in case it's something completely obvious.

thanks!
Looks like he wants a page break. You probably know that '\n' is the new line character, and will advance to the next line. See if you can find a bunch of special characters, and find the one that advances to the next line.
 
Hrm... maybe he meant "advances to the next line"?
 
Next line is all I can figure - and I can't find anything about "next page" anywhere in my book. However, there's plenty of instruction in the first chapters about going to the next line.
Thanks for your help.
 
\f - form feed
\r - carriage return
\v - vertical tab

If you look in the index of your book, you should find these. Or look up "escape sequences." Anyways, the 3 above are the ones I would think most likely to produce a new page... experiment and let us know what does what.
 
Who knows,

He may want you to wait for an input after the "to be continued", and then clear the page by having enough \n's.
 
I agreed completely !
3 months later, new school year begins in schools in America. Are you making some preparations for it ?

______________________________________________

My signature:
>>>> Some places i have learned are full of injuries, tears, and blood, if that is what people call a little actual love for their lovers, they should never try to bring their lovers to such places <<<<

Please don't quote this post of mine because my signature will go with your quote...<SAL>(smile a lot)
 
aha! here's what my prof sez:

This is a case of "old" terminology corrupting the modern generation. In my day, printers used continuous feed paper where you had to separate each sheet along the perforation. To tell the printer to go to the next sheet, or "form", you did a form feed command to the printer. The terminology is still used on occation today to mean "next page". The printf escape sequence is \f for "Form feed" which really means "page break" or "advance to next page".