24 lines
530 B
C
24 lines
530 B
C
#include <stdio.h>
|
|
#include <math.h>
|
|
|
|
// Here we define a simple macro
|
|
#define PI 3.14159265359f
|
|
|
|
// Another macro with parameters
|
|
// TODO: Fix the problem with this macro
|
|
#define Square(x) (x*x)
|
|
|
|
// TODO: define a macro that doubles the value of an variable.
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
float pisqr = Square(PI);
|
|
printf("Pi to the power of 2 is equal to %f\n",pisqr);
|
|
|
|
int value = Square(1+2);
|
|
printf("3 squared is %d\n", value);
|
|
|
|
// TODO: call your double macro on value
|
|
printf("3 squared doubled is %d", value);
|
|
}
|