O'Reilly logo

C Primer Plus, Fourth Edition by Stephen Prata

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

Arguments and Pitfalls

It's worth repeating and amplifying a caution made earlier in this chapter about using printf(). The items of information passed to a function, as you may recall, are termed arguments. For instance, the function call printf("Hello, pal.") has one argument, "Hello, pal.". A series of characters in quotes, such as "Hello, pal.", is called a string. We'll discuss strings in Chapter 4. For now, the important point is that one string, even one containing several words and punctuation marks, counts as one argument.

Similarly, the function call scanf("%d", &weight) has two arguments, "%d” and &weight. C uses commas to separate arguments to a function. The printf() and scanf() functions are unusual in that they aren't limited to ...

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