Tutorials and C programs with code and output for beginners
c programming
C > 06. Advanced Functions
  1. A Function with Two Results
    This program shows a function that generates two results. One result is returned, the other accessed from the main via an address.
  2. The bigger2 Function: Using Pointer Arguments
    This function returns nothing but will change the value of the variable in the calling function's memory area.
  3. The Prime Numbers Function
    A function that determines if a number is prime or not. The function returs 1 if prime, 0 if not. In addition, the function will "return" the value of one of the divisors.
  4. The Divisors Program
    A program that prints all the smallest divisors of the integers between 1 and 50 and indicates prime numbers with and asterisk.
  5. The double_triple Function: Two Results by Reference
    A function that takes in an integer number and "returns" both twice the number and three times the number.
  6. The separate Function: Multiple Results by Reference
    A function that takes a real number and splits it into three parts: a sign (character), a whole part (integer) and a fraction (double).
  7. The readex Function: Two results from a scanf
    A simple addition reader/parser for 2 doubles.
  8. The multiply Function: Using Recursion
    A function that multiplies two integers without using the multiplication (*) operator.
  9. The evaluate Function
    A function that gets the results of another function with different argument values. Uses a function as a parameter.
  10. The Function Roots Program
    A program finding function roots using the bisection method.
  11. The Fraction Evaluation Function
    A function that evaluates a fraction specified as a numerator and denominator.
  12. The Swap Numbers Function
    A void function that swaps two numbers depending on their values.
  13. The Factorial Function (Recursive)
    A recursive version of a function that calculates the factorial on an integer number.
  14. The Recursive Fibonacci Function
    A recursive version of a function that returns the nth number in the Fibonacci sequence.
  15. The Recursive GCD Function
    A recursive function that finds the greatest common divisor of two integer numbers.
  16. The find_caps Function
    A recursive function that extracts capital letters from a string and puts them into another string.
  17. The select_sort Function
    A recursive that sorts and array of integers in ascending order.
COPYRIGHT © 2015-2024 IHY PRESS Frankfurt am Main 60329 Deutschland