c程序代做
1.6 – The Preprocessor
All exercises in this Level must be coded exclusively in C syntax (no
<iostream>, cout, cin, classes, etc.)
Exercise 1
Write a C-program that contains two print macro calls. The first prints the variable a, the
second prints the variables a and b. Printing happens by the use of the PRINT1 and
PRINT2 macros that accept arguments. These macros must be defined in an include-file.
The variables a and b gets their value in the function main().
Name the program “Macro.c” and the include-file “Defs.h”. Don’t forget to implement
the mechanism to avoid multiple inclusion of the header file.
Exercise 2
Create the two macros MAX2(x,y) and MAX3(x,y,z). These macros must return the
maximum value of the given arguments. Let the macro MAX3 make use of the macro
MAX2. Add these macros to the file “Defs.h”.
1.7 – Pointers and Arrays
Exercise 1
Try to create a function Swap(). This function must exchange the value of two variables.
For example: if i=123 and j=456, then i=456