Skip to Main Content
C Programming: Visual Quickstart Guide
book

C Programming: Visual Quickstart Guide

by Larry Ullman, Marc Liyanage
October 2004
Beginner content levelBeginner
408 pages
9h 24m
English
Peachpit Press
Content preview from C Programming: Visual Quickstart Guide

Creating Functions That Take Arguments

The next logical evolution of your user-defined functions is to have them take arguments. Most C functions take arguments, like isalpha(), which expects a character to be passed to it. To have your functions take arguments, you need to define them—both in the prototype and in the formal definition—with the type of arguments expected:

void my_func (int age, int year);
int main (void) {
   // Call my_func().
}
void my_func (int age, int year) { ...

When calling a function that takes arguments, you need to then pass it the appropriate values. As you've already seen, there are many ways of doing this, from passing literal values to variable values to the results of calculations. Each of these function calls are ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Intermediate C Programming

Intermediate C Programming

Yung-Hsiang Lu
Data Structures Using C

Data Structures Using C

Samir Kumar Bandyopadhyay, Kashi Nath Dey

Publisher Resources

ISBN: 0321287630Purchase book