logo

Quick introduction to macros

#include <stdio.h> #include <stdlib.h> #include <string.h> #define SIZE 8 #define PRODUCT(X, Y) (X) * (Y) int main(int argc, char* argv[]) { int arr[SIZE]; int i; for (i = 0; i < SIZE; i++) { arr[i] = 12; } int a = 2, b = 6; printf("%d\n", PRODUCT(a + 1, b)); return 0; }
Course thumb

The C programming language made simple