C and Data Structures E Balagurusamy Vice Chancellor Anna University, Chennai register TO THE USER This CD-ROM contains chapter-wise program manikins with source code. These are in gain to those given in the text. We hope the user finds them utile in enhancing his understanding of the text and also in underdeveloped his programing skills using C. INTRODUCTION This is an example for a crude(a) successor macro instruction instruction. /************************************************************/ /* truthful macro substitution */ /************************************************************/ # nail down AND && main() { char a,b; a = A; b = A; } if (a AND b) printf(Same); This is an example for a simple substitution macro. This macro has a C function printf() in its body. /************************************************************/ /* simple macro substitution with function */ /************************************************************/ # furbish up A ND && #define MESSAGE printf(Same...) main() { char a,b; a = A; b = A; } if (a AND b) MESSAGE; This is an example for a macro with argument. It calculates the field of view of a circle. /************************************************************/ /* macro with arguments */ /************************************************************/ #define AREA(r) (3.
14 * r * r) main() { float r; printf(Enter universal gas constant : ); scanf(%f,&r); printf(Area is : %f,AREA(r)); } 3 This is an example for a macro with arguments containing relational operators and nesting of macro. It checks whether the input value i s a number or alphabet. /******************! ******************************************/ /* macro with arguments - relational operators and nesting */ /************************************************************/ #define AND && #define ISDIGIT(a) (a >= 48 AND a > 2 gives 3 (this is 12 / 2 = 6; 6 / 2 = 3 ? one division by 2 for each shift), whereas 13 >> 1 will give whole 6 (13 / 2 = 6 ? decimal portion is truncated)....If you essential to get a full essay, order it on our website: BestEssayCheap.com
If you want to get a full essay, visit our page: cheap essay
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.