Lec38 - Computer Programming I TA C162. Today's Agenda C...

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

View Full Document Right Arrow Icon
1 Computer Programming I TA C162 . 21 Apr 2007 Today’s Agenda C Preprocessor Preprocessor Directives Macro expansion File inclusion Conditional Compilation
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Computer Programming I TA C162 . 21 Apr 2007 The C Preprocessor  Program that processes source program before   it is passed to the compiler  Preprocessor commands called as Directives  Each directives begin with  a # symbol  
Background image of page 2
3 Computer Programming I TA C162 . 21 Apr 2007 C Program Execution Text editor                                       C Source Code Expanded Source Code Object Code Executable Code Preprocessor Compiler Linker
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 Computer Programming I TA C162 . 21 Apr 2007 Macro Expansion Directives: Example(1) #define MAX 100 #define SIZE 10 void main() { int k, a[SIZE]; for(k=0; k<MAX; k+=10) printf(“%d”,k); } During preprocessing each occurrence of MAX is replaces by  100 and each occurrence of SIZE is replaced by 10. 
Background image of page 4
5 Computer Programming I TA C162 . 21 Apr 2007 Example(2): Define Operators #define AND #define OR || #define EQUALS == #define MOD % #define NOTEQUAL != void Leap_year(unsigned int yr)
Background image of page 5

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

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

Page1 / 15

Lec38 - Computer Programming I TA C162. Today's Agenda C...

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

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