13tien xu li - Ch th ti n x l Ti n x l [email protected]..

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

View Full Document Right Arrow Icon
1 Ti n x [email protected] Ch th ti n x • Ti n x lý là pha ñầ u tiên c a quá trình biên d ch • Cho phép lo i b các chú thích và s a ñổ i ch ươ ng trình ñ ích theo m t s ch th ti n x • Các ch th ti n x lý luôn b t ñầ u dòng b ng kí t # #define • Dùng ñể ñị nh ngh ĩ a m t bí danh trong ch ươ ng trình • S d ng bí danh cho m t h ng s #define TRUE 1 #define FALSE 0 • S d ng bí danh làm macro #define MULT(a, b) ((a)*(b)) int x = 2*MULT(1+2,3);/*x=2*((1+2)*(3))*/ #define MULT2(a, b) a*b int y = 2*MULT2(1+2, 3); /* y=2*1+2*3 */ Các macro thông d ng #define ABS(x) ( (x)>=0 ? (x):(-(x)) ) #define MAX(a, b) ((a)>=(b) ? (a):(b)) #define MIN(a, b) ((a)<=(b) ? (a):(b)) #define SQR(x) ((x)*(x)) #include • Dùng ñể ghép m t t p ngu n vào v trí hi n t
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 04/09/2012 for the course ECON 102 taught by Professor Abc during the Spring '12 term at Univ. of Massachusetts Med. School.

Page1 / 3

13tien xu li - Ch th ti n x l Ti n x l [email protected]..

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