C Language Function Example

https:/‮l.www/‬autturi.com
C Language Function Example
/*
function example in C language
*/

#include <stdio.h>
#include <stdlib.h>

// function prototype, Also called a function declaration
int addNumbers(int a, int b);         

int main()
{
    int n1,n2,sum;

    printf("Enters two numbers: ");
    scanf("%d %d",&n1,&n2);

    // calling the function
    sum = addNumbers(n1, n2);        
    printf("sum = %d",sum);

    return 0;
}

// (function definition)
int addNumbers(int a, int b)            
{
    int result;
    result = a+b;
    return result; 
}
Created Time:2017-08-28 19:05:07  Author:lautturi