O'Reilly logo

C Programming: Visual Quickstart Guide by Marc Liyanage, Larry Ullman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Printing Text

If you were to compile and run the template.c example (written in the previous section), it should work, but it won't do much. To take this up one notch, you'll have the application print a message when it's run. This example will teach you how to create a simple Hello, world! program, a staple of any programming text.

To print text in C, use the printf() function:

printf("I could catch a monkey.");

The printf() function is a printing function with formatting capability (hence, the f). Throughout the rest of the book, beginning with Chapter 3, “Working with Numbers,” you'll see how to format text with printf(), but for the time being, it will be used in its most basic way.

Before getting into an example, you should revisit the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required