CSC209H5 Chapter 5: C Programming - Header Files

25 views2 pages

Document Summary

Csc209h5s - software programming and tools (winter 2018) Each file is compiled separately and linked together in the linking stages. Example: compile files separately and link them afterwards. If the functions have inconsistent types, you may get a segmentation fault and a type mismatch. We use header files to declare what functions do and what function parameters are required. Example: sorts. h typedef void (*sortfunc_t)( int *, int ); void bubble_sort( int *, int ); void selection_sort( int *, int ); void insertion_sort( int *, int ); When you try to compile the program above, you would receive many errors as you are using names that you have not defined. You do this by including the header file in the other (. c) files. You need to make sure the function parameter types are consistent. If you get a duplicate symbol error, it means you have declared a variable/value etc. twice in a file.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents