September 2001
Beginner
970 pages
23h 20m
English
By now, you're familiar with using function arguments. The next step along the road to function mastery is learning how to write your own functions that use arguments. Let's preview that skill now. (At this point, you might want to review the butler() function example near the end of Chapter 2, “Introducing C”; it shows how to write a function without an argument.) Listing 5.15 includes a pound() function that prints a specified number of pound signs (#). The example also illustrates some points about type conversion.
/* pound.c -- defines a function with an argument */ #include <stdio.h> void pound(int n); /* ANSI prototype */ int main(void) { int times = 5; char ch = '!'; /* ASCII code ... |
Read now
Unlock full access