1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>

#define A 12
#define B 12 + 5
#define add_5(n) (n + 5)  // almost fixed
#define triple(n) (n * 3)  // BUG!!!!

int main(int argc, char* argv[]) {
    printf("A == %d\n", A);
    printf("B == %d\n", B);
    printf("B * 2 == %d\n", B * 2);
    // => printf("B * 2 == %d\n", 12 + 5 * 2);
    
    printf("add_5(10) == %d\n", add_5(10));
    printf("add_5(10) * 1000 == %d\n", add_5(10) * 1000);

    printf("triple(5) == %d\n", triple(5));
    printf("triple(5 + 1) == %d\n", triple(5 + 1));
    
    return EXIT_SUCCESS;
}
/* vim: set tabstop=4 shiftwidth=4 fileencoding=utf-8 noexpandtab: */

© Copyright 2024 Alexander J. Quinn         This content is protected and may not be shared, uploaded, or distributed.