C function with an argument and no return value

C function with an argument and no return value.

  1. #include<stdio.h>

  2. void print_line(int);

  3. int main()
  4. {
  5.      print_line(2); //this will pass 2 two print_line() function
  6.      printf("Hello World\n");
  7.      print_line(3); //this will pass 3 two print_line() function
  8.      return 0; 
  9.      }
  10. void print_line(int n)
  11. {
  12.      int i;
  13.           for(i=0; i<n; i++)
  14.                {
  15.                           printf("------------\n"); 
  16.                                }
  17.                                } 

Output

------------
------------
Hello World
------------
------------
------------

choose next program from this list

Comments