November 2013
Beginner
325 pages
9h 47m
English
Now that you know how functions work, let’s take a closer look at the printf function that you have been using to write to the log.
The printf function accepts a string as an argument and prints it to the log. A string is a “string” of characters strung together like beads on a necklace. Typically, a string is text.
A literal string is text surrounded by double quotes. In the AGoodStart project from Chapter 2, you called printf() with literal string arguments:
// Print the beginning of the novel
printf("It was the best of times.\n");
printf("It was the worst of times.\n");
Your output looked like this:
It was the best of times. It was the worst of times.
You can store a literal string in a variable ...
Read now
Unlock full access