/* types.c * * In C, each function must have an explicit type signature. * You cannot have two versions of the same function with * different types. So this attempt to have two versions * of plus(), one for integers and one for floats, fails. * * $ gcc types.c -o types * types.c:12:7: error: conflicting types for 'plus' * float plus(float a, float b){ * ^ * * Jim Mahoney | cs.bennington.college | MIT License | Oct 2021 */ #include int plus(int a, int b){ printf(" -- int plus -- \n"); return a + b; } float plus(float a, float b){ printf(" -- float plus -- \n"); return a + b; } int main(){ int i=3; int j=4; float x=3.2; float y=4.1; printf(" %d + %d is %d \n", i, j, plus(i,j)); printf(" %d + %d is %d \n", x, y, plus(x,y)); return 0; }