{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lec08

lec08 - The Preprocessor CS 2022 Introduction to C...

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

View Full Document Right Arrow Icon
The Preprocessor CS 2022: Introduction to C Instructor: Hussam Abu-Libdeh Cornell University (based on slides by Saikat Guha) Fall 2009, Lecture 8 The Preprocessor CS 2022, Fall 2009, Lecture 8
Background image of page 1

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

View Full Document Right Arrow Icon
Preprocessor I Commands to the compiler I Include files, shortcuts, conditional compilation I Command must start at beginning of line Common preprocessor commands I #include I #define I #ifdef / #ifndef The Preprocessor CS 2022, Fall 2009, Lecture 8
Background image of page 2
Running just the preprocessor gcc -E -o preprocessed .c project.c The Preprocessor CS 2022, Fall 2009, Lecture 8
Background image of page 3

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

View Full Document Right Arrow Icon
#include : Header Files I Includes files: Literally copy-paste I Typically header files Header File Declares I External functions I Variable types I External global variables Typically named *.h (or sometimes *.hpp for C++) The Preprocessor CS 2022, Fall 2009, Lecture 8
Background image of page 4
#include : Header Files mylib.h int max(int a, int b); mylib.c #include "mylib.h" int max(int a, int b) { return (a > b ? a : b); } The Preprocessor CS 2022, Fall 2009, Lecture 8
Background image of page 5

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

View Full Document Right Arrow Icon
#include : Header Files project.c #include "mylib.h" void foo() { ...
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}