Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
#include<stdio.h> #include "mymath.h" int main() { int x = add(2, 4); int y = multiply(2, 2); printf("Result of add: %d\n", x); printf("Result of multiply: %d\n", y); return 0; }
calc: calc.c gcc -Wall -ansi -pedantic calc.c mymath.c -o calc test: test.c gcc -Wall -ansi -pedantic test.c mymath.c -o test ./test
int add(int x, int y) { return x + y; } int multiply(int x, int y) { return x + y; }
int add(int x, int y); int multiply(int x, int y);
#include<stdio.h> #include<assert.h> #include "mymath.h" int main() { int result; result = add(1, 1); assert(2 == result); assert(4 == multiply(2, 2)); assert(6 == multiply(2, 3)); return 0; }