IHYPRESS PROGRAMMING

Tutorials and C programs with code and output for beginners

C > 06. Advanced Functions

- 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. - 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. - 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. - 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. - 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. - 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). - The
*readex*Function: Two results from a scanf

A simple addition reader/parser for 2 doubles. - The
*multiply*Function: Using Recursion

A function that multiplies two integers without using the multiplication (*) operator. - The
*evaluate*Function

A function that gets the results of another function with different argument values. Uses a function as a parameter. - The Function Roots Program

A program finding function roots using the bisection method. - The Fraction Evaluation Function

A function that evaluates a fraction specified as a numerator and denominator. - The Swap Numbers Function

A void function that swaps two numbers depending on their values. - The Factorial Function (Recursive)

A recursive version of a function that calculates the factorial on an integer number. - The Recursive Fibonacci Function

A recursive version of a function that returns the nth number in the Fibonacci sequence. - The Recursive GCD Function

A recursive function that finds the greatest common divisor of two integer numbers. - The find_caps Function

A recursive function that extracts capital letters from a string and puts them into another string. - 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