pound.c 554 B

12345678910111213141516171819202122
  1. /* pound.c -- defines a function with an argument */
  2. #include <stdio.h>
  3. void pound(int n); // ANSI function prototype declaration
  4. int main(void)
  5. {
  6. int times = 5;
  7. char ch = '!'; // ASCII code is 33
  8. float f = 6.0f;
  9. pound(times); // int argument
  10. pound(ch); // same as pound((int)ch);
  11. pound(f); // same as pound((int)f);
  12. return 0;
  13. }
  14. void pound(int n) // ANSI-style function header
  15. { // says takes one int argument
  16. while (n-- > 0)
  17. printf("#");
  18. printf("\n");
  19. }