misuse.c 359 B

123456789101112131415161718
  1. /* misuse.c -- uses a function incorrectly */
  2. #include <stdio.h>
  3. int imax(); /* old-style declaration */
  4. int main(void)
  5. {
  6. printf("The maximum of %d and %d is %d.\n",
  7. 3, 5, imax(3));
  8. printf("The maximum of %d and %d is %d.\n",
  9. 3, 5, imax(3.0, 5.0));
  10. return 0;
  11. }
  12. int imax(n, m)
  13. int n, m;
  14. {
  15. return (n > m ? n : m);
  16. }