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 or parameters. 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 ...

Get C Primer Plus®, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.