[圖解C] 巨集指令(macro instruction)

#define  name  value         定義常數
#define  name  string        定義字串
#define  name  expression    巨集指令


// Example 824: macro instruction
#include <stdio.h>
#include <stdlib.h>

#define flower 8
#define say "happy birthday"
#define area r*r*3.14

int main()
{
    printf("%d\n", flower * 1314);
   
    // there is no "" for string defined
    printf(say"\n");
   
    int r;
    printf("enter the radius: ");
    scanf("%d", &r);
    // using %f because of 3.14 (float)
    printf("area = %f\n", area);
   
    system("pause");
    return 0;
}