c.ihypress.ca: examples of C programs
Home > 05. Functions I
  1. The stars function: a void function without argument
    A function that displays a line of stars on the screen.
  2. The stars2 function: a void function with one argument
    A function that displays a line of stars of variable length depending on a numerical value.
  3. The stars2 function using a prototype
    The same function as before but with a prototype declared at the top of the program.
  4. The factorial function: one argument, one result
    A function that computes the factorial of an integer number.
  5. The bigger function: two arguments, one result
    A function that takes in two numbers and returns the largest value of the two.
  6. Prime numbers (by value)
    A function that returns 1 if a number is prime and 0 otherwise.
  7. A list of prime numbers
    A program displaying the list of all prime numbers between 1 and 1000. It uses the previous function.
Ihypress.ca is online since February 17, 2005.
 
[ Polycom | Caribbean Hotel | dj music download ]