Computer Science, asked by amit9322, 1 year ago

what is function xplain function declartion
fonction call an fonction defintion with
exmple progam​

Answers

Answered by kimnari4
4

Answer:

A function is a block of organized, reusable code that is used to perform a single, related action. ... Different programming languages name them differently, for example, functions, methods, sub-routines, procedures, etc.

Explanation:

A function is a group of statements that together perform a task. ... A function declaration tells the compiler about a function's name, return type, and parameters.

A function is a group of statements that together perform a task. ... A function declaration tells the compiler about a function's name, return type, and parameters.

return_type function_name (argument list)

{

Set of statements – Block of code

}

include <stdio.h>

int addition(int num1, int num2)

{

int sum;

/* Arguments are used here*/

sum = num1+num2;

/* Function return type is integer so we are returning

* an integer value, the sum of the passed numbers.

*/

return sum;

}

int main()

{

int var1, var2;

printf("Enter number 1: ");

scanf("%d",&var1);

printf("Enter number 2: ");

scanf("%d",&var2);

/* Calling the function here, the function return type

* is integer so we need an integer variable to hold the

* returned value of this function.

*/

int res = addition(var1, var2);

printf ("Output: %d", res);

return 0;

}

hope it helps

Similar questions