what is a function in computer science
Answers
Answered by
23
Explanation:
In programming, a named section of a program that performs a specific task. In this sense, a function is a type of procedure or routine. Some programming languages make a distinction between a function, which returns a value, and a procedure, which performs some operation but does not return a value.
hope its help u
FOLLOW ME
Answered by
0
Answer: - A function in computer science is a block of organized and reusable code that is used to perform a single or related action.
- A function is a block of organized and reusable code that is used to perform a single or related action.
- Functions provide better modularity for our application and a high degree of code for reusing.
- We have already went through the various functions like the printf() and main().
- These are called as the built-in functions provided by the language itself, but we can write our own functions as well.
- The functions are famous with several names.
- Evert different programming languages name the functions differently, for example, the functions, the methods, the sub-routines, the procedures, etc.
- The definition of the function consists of the function header and the function body.
Here are given all the parts of a function: -
1. Return Type: -
- A function might return a value.
- The return type is always the data type of the value that the function will return.
- Some functions perform the desired operations you want without returning the value.
- In this case, the return type is then written as the keyword void.
2. Function Name: -
- This is called as the actual name of the different function.
- The function name and the parameter list all together constitute and is as the function signature.
3. Parameter List: -
- A parameter is like the place holder.
- When a function is invoked, then we will pass a value as a parameter.
- This given value is referred to as the actual parameter or the argument of the function.
- The parameter list refers to the type, order, and the number of the parameters of the given function.
- Parameters are optional, i.e., a function may contain of no parameters.
4. Function Body: -
- The function body contains the collection of the statements that defines what the function does.
To know more about the topic, go to the following links: -
https://brainly.in/question/28076071
https://brainly.in/question/31754689
#SPJ6
Similar questions
India Languages,
5 months ago
English,
5 months ago
Math,
5 months ago
English,
10 months ago
Chemistry,
1 year ago