Lecture41 - ComputerProgrammingITAC162. TodaysAgenda 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 . 24 Apr 2006 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 . 24 Apr 2006 The C Preprocessor Program that processes source program before it ispassed 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 . 24 Apr 2006 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 . 24 Apr 2006 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
Computer Programming I TA C162 . 24 Apr 2006 Example(2): Define Operators #define AND #define OR || #define EQUALS == #define MOD % #define NOTEQUAL != void Leap_year(int yr) { if((yr MOD 4 EQUALS
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.

This note was uploaded on 05/14/2010 for the course CS SS ZG653 taught by Professor Shanta during the Spring '09 term at Birla Institute of Technology & Science.

Page1 / 15

Lecture41 - ComputerProgrammingITAC162. TodaysAgenda 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