Function with no return type with arguments in C


The program is a simple example of a function in C programming. The program defines a function named "add" which takes two integers as input and returns their sum. The main function of the program first takes two integers as input from the user and then calls the add function passing the two integers as arguments.

The add function then performs the addition operation on the two integers and prints the result. The function "void add(int,int);" is known as function prototype or function declaration which tells the compiler about the return type of function and the number of arguments that the function takes.

Source Code

#include<stdio.h>
void add(int,int);
int main()
{
    int a,b;
    printf("\nEnter The Two Values:");
    scanf("%d%d",&a,&b);
    add(a,b);
    return 0;
}
void add(int a,int b)
{
    int c;
    c=a+b;
    printf("\nAddition:%d",c);
}
To download raw file Click Here

Output

Enter The Two values:3
4
Addition:7


List of Programs


Sample Programs


Switch Case in C


Conditional Operators in C


Goto Statement in C


While Loop Example Programs


Looping Statements in C

For Loop Example Programs


Array Examples in C

One Dimensional Array


Two Dimensional Array in C


String Example Programs in C


Functions Example Programs in C