/* 
* Code Snippets for this week
* Small programs to show bits of C and bits of C. 
* >> I've tried to put * at the start of all the comment lines. 
*/

/* 
* To declare a function
*
*/

/* return-value-type functionName( paramter-type paramter-name, paramter-type paramter-name) 
* Two paramters show in the above and one below. 
*/ 

/* prototype - top of file, before main */
int myFunctionName(int);

/* funciton body, note must match its prototype in terms of retrun type and paramters */
int myFunctionName(int myParamter)
{
    /* Local variable */
    int x;


    /*must end with a return - of the correct type */
    return x;
}

/*
* Calling a  function 
* - use function name followed by a paramter list
*/
int myIntCalledA = 6;

int variableForTheReturnValue = myFunctionName(myIntCalledA);

*/
* void functions
* - functions can have both void return types (return nothing) and empty paramter lists
*/

/* Prototype - note empty paramter list*/
void printLine();

/* function body */
void printLine()
{
    printf("*********************************");
    */void function has no return*/
}

/* Working with functions - short example */

#include <stdio.h>

/* prototype for add things together function */
int addThings(int, int);

int main(char* argv, int argc)
{
    int first = 10;
    int second = 20;
    
    int result = addThings(first, second);

    printf("%d\n", result);
    exit(0);
}

int addThings(int a, int b)
{
    int local = a + b;
    return local;
}

