Computer Science, asked by rashikajn27, 8 months ago

Explain the category of function depending on the existence of data communication between calling
and called function.​

Answers

Answered by Anonymous
1

Answer:

Explanation:

A function depending an whether the arguments are present or not and whether a value is returned or not, may belong to one of following categories

Function with no return values, no arguments

Functions with arguments, no return values

Functions with arguments and return values

Functions with no arguments and return values.

1.).In this category, the function has no arguments. It does not receive any data from the calling function. Similarly, it doesn’t return any value. The calling function doesn’t receive any data from the called function. So, there is no communication between calling and called functions.

2.)In this category, function has some arguments . it receives data from the calling function, but it doesn’t return a value to the calling function. The calling function doesn’t receive any data from the called function. So, it is one way data communication between called and calling functions.

Note:

In the main() function, n value is passed to the nat() function. The n value is now stored in the formal argument n, declared in the function definition and subsequently, the natural numbers upto n are obtained.

3.)In this category, functions has some arguments and it receives data from the calling function. Simillarly, it returns a value to the calling function. The calling function receives data from the called function. So, it is two-way data communication between calling and called functions.

Eg:

view sourceprint?

01

#include< stdio.h>

02

#include<conio.h>

03

int fact(int);

04

void main()

05

{  

06

 int n;

07

 clrscr();

08

 printf("\n Enter n:");

09

 scanf("%d",&n);

10

 printf("\n Factorial of the number : %d", fact(n));

11

 getch();

12

}

13

 

14

int fact(int n)

15

{

16

 int i,f;

17

 for(i=1,f=1;i<=n;i++)

18

 f=f*i;

19

 return(f);

20

}

Similar questions
Math, 4 months ago