lecture23-mar25 - Announcements Lecture 23 Read Ch. 15 and...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Announcements Lecture 23 • Read Ch. 15 and 17 • Assignment 5 – Q&A, designs due on Friday • Exam 2, a week from Friday • Topics for today – File inclusion directives – Header file usage – Dynamic storage allocation and deallocation – Pointers - advanced uses (time permitting) • Linked lists File Inclusion • The #include directive causes the entire contents of a file to be included in a source program. • Files included into a program are called header files (or included files). – By convention, header files have the extension .h . • One form of #include is used for files that belong to the C library: #include <filename> • Most compilers will search the directory (or directories) where system header files are kept. #include <stdio.h> /* what’s really in stdio.h ? */ File Inclusion (2) • The other form of #include is used for files created by the programmer: #include "filename" • Most compilers will search the current directory first, then search the directory (or directories) where system header files are kept. • File names may include a drive specifier and/or a directory path description: #include <sys\stat.h> #include "utils.h" #include "d:utils.h" #include "\cprogs\utils.h" #include "d:\cprogs\utils.h" Source Files • A program may be divided into any number of source files. – Source files have the extension .c by convention. • Source files contain definitions of functions and variables. • Only one source file must contain a definition of main (the program’s entry point). • Dividing a program into multiple files has several advantages: – Related functions can be grouped together into a single file, making the structure of the program clearer. – Each source file can be compiled separately. – A single source file can be shared by several programs.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/24/2010 for the course EE 312 taught by Professor Shafer during the Spring '08 term at University of Texas at Austin.

Page1 / 3

lecture23-mar25 - Announcements Lecture 23 Read Ch. 15 and...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online