Functions Flashcards

1
Q

What is Function?

A

Functions in C are the basic building blocks of a C program. A function is a set of statements enclosed within curly brackets ({}) that take inputs, do the computation, and provide the resultant output. You can call a function multiple times, thereby allowing reusability and modularity in C programming.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to Declare a Function?

A
  1. function type { for ex. int,void}
  2. function name
  3. function parameters {ex. int a,int b}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Function Definition?

A

A Function definition. consists of function header and function body

1.function type
2.function name
3.function parameters.
4.Declaring Local Variables.
5.Function statements.
6.Return Statements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the components of Function Header?

A
  1. Return type
  2. Function Name.
  3. Function Parameters.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the components of Function body?

A

1.Local Variables.
2.Function Statements.
3.Return Statements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Note

A

1.When a function reaches its return statements, the control is transferred
back to the calling program.
2. In the absence of return statement, the closing brace acts as a void
return.
3. A local variable is a variable that is defined in the function and cannot
be used outside the function.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

how to call a functions?

A

By function name(function parameters);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly