Explain category of functions with examples?

1 Answer

Answer :

CATEGORY OF FUNCTIONS : A function, depending on whether arguments are present or not and
whether a value is returned or not. The following are the function prototypes.
 1 : Functions with no Parameters and no Return Values.
 2 : Functions with no Parameters and Return Values.
 3 : Functions with Parameters and no Return Values.
 4 : Functions with Parameters and Return Values.
1 : Functions with no Parameters and no Return Values :

1 : In this category, there is no data transfer between the calling function and called function.
2 : But there is flow of control from calling function to the called function.
3 : When no parameters are there , the function cannot receive any value from the calling function.
4: When the function does not return a value, the calling function cannot receive any value from the called
function.
Ex #include<stdio.h>
 #include<conio.h>
 void sum();
 void main()
 {
 sum();
 getch();
 }
 void sum()
 {
 int a,b,c;
 printf("enter the values of a and b");
 scanf("%d%d",&a,&b);
 c=a+b;
 printf("sum=%d",c);
 }
2 : Functions with no Parameters and Return Values.
1 : In this category, there is no data transfer between the calling function and called function.
2 : But there is data transfer from called function to the calling function.
3 : When no parameters are there , the function cannot receive any values from the calling function.
4: When the function returns a value, the calling function receives one value from the called function.
Ex : #include<stdio.h>
#include<conio.h>
 int sum();
 void main()
 {
 int c;
 clrscr();
 c=sum();
 printf("sum=%d",c);
 getch();
 }
 int sum()
 {
 int a,b,c;
 printf("enter the values of a and b");
 scanf("%d%d",&a,&b);
 c=a+b;
 return c;
 }

3 : Functions with Parameters and no Return Values.
1 : In this category, there is data transfer from the calling function to the called function using parameters.
2 : But there is no data transfer from called function to the calling function.
3 : When parameters are there , the function can receive any values from the calling function.
4: When the function does not return a value, the calling function cannot receive any value from the called
function.
Ex : #include<stdio.h>
 #include<conio.h>
 void sum(int a,int b);
 void main()
 {
 int m,n;
 clrscr();
 printf("Enter m and n values:");
 scanf("%d%d",&m,&n);
 sum(m,n);
 getch();
 }
 void sum(int a,int b)
 {
 int c;
 c=a+b;
 printf("sum=%d",c);
}
4 : Functions with Parameters and Return Values.
1 : In this category, there is data transfer from the calling function to the called function using parameters.
2 : But there is no data transfer from called function to the calling function.
3 : When parameters are there , the function can receive any values from the calling function.
4: When the function returns a value, the calling function receive a value from the called function.
Ex :
 #include<stdio.h>
 #include<conio.h>
int sum(int a,int b);
void main()
{
 int m,n,c;
 clrscr();
printf("Enter m and n values");
 scanf("%d%d",&m,&n);
 c=sum(m,n);
 printf("sum=%d",c);
 getch();
 }
int sum(int a,int b)
 {
 int c;
c=a+b;
return c;
 }

Related questions

Description : Write categeory of functions ?

Last Answer : CATEGORY OF FUNCTIONS : A function, depending on whether arguments are present or not and whether a value is returned or not. The following are the function prototypes. 1 : Functions with no ... : Functions with Parameters and no Return Values. 4 : Functions with Parameters and Return Values.

Description : Write types of functions?

Last Answer : The functions can be classified into two categories. 1 : Built in Functions (OR) Library Functions 2 : User-defined Functions. 1 : Built-in Functions (OR) Library Functions : The standard C ... increase efficiency of program. 4 : Function sharing : A function can be shared by many programmers.

Description : Write a C program addition of two matrices?

Last Answer : #include #include void main() { int a[25][25],b[25][25],c[25][25],i,j,m,n; clrscr(); printf("enter the rows and colums of two matrics:\n"); scanf("%d%d",&m,&n); printf("\nenter the elements of A matrics"); for(i=0;i

Description : Write a C program multiplication of two matrices?

Last Answer : // Write a C program Multiplication of Two Matrices. #include #include void main() { int a[25][25],b[25][25],c[25][25],i,j,m,n,k,r,s; clrscr(); printf("enter the rows and colums of A matrics:\n"); ... B matrics:\n"); scanf("%d%d",&r,&s); printf("\nenter the elements of A matrics"); for(i=0;i

Description : What is call by value and call by reference?

Last Answer : PASSING PARAMETERS TO FUNCTIONS : The called function receives the information from the calling function through the parameters. The variables used while invoking the calling function are called actual parameters and the variables used in the ... *b) { int temp; temp=*a; *a=*b; *b=temp; }

Description : what is function? Write types of function with example?

Last Answer : Function: Function means, a large program can be divided into a series of individual related programs called modules. These modules are called functions. A function is a program segment that carries out ... efficiency of program. 4 : Function sharing : A function can be shared by many programmers.

Description : How to initialization of array with example?

Last Answer : Initilization of Array : assigning the required information to a variable before processing is called initialization.we can initialize the individual elements of an array. Array elements can be initialized at the time of declaration. Syntax : ... M','P','U','T','E','R'}; char b[] = COMPUTER ;

Description : What is an Array? Write advantages of arrays?

Last Answer : An array is a collection of similar data items. All the data items of an array are stored in continuous memory locations in RAM. The elements of an array are of same data type and each item can be accessed using the same name.

Description : What is the macro function?

Last Answer : Macro Substitution : They are two types of macro substitution. 1 : Macro substitution without arguments. 2 : Macro substitution with arguments. 1 : Macro substitution without arguments : It is a process to ... varn like the formal parameters in a function definition. Ex : #define PROD(x) (x*x)

Description : What is call by reference? (OR) what is pass by reference?

Last Answer : Pass by reference (OR) Call by Reference : In pass by reference, a function is called with addresses of actual parameters. In the function header, the formal parameters receive the addresses of actual parameters. Now the formal parameters do ... a,int *b) { int temp; temp=*a; *a=*b; *b=temp; }

Description : What is call by value? (OR) what is pass by value?

Last Answer : Pass by value (OR) Call by value : When a function is called with actual parameters, the values of actual parameters are copied into formal parameters. If the values of the formal parametes changes in the function, the values of ... void swap(int a,int b) { int temp; temp=a; a=b; b=temp; }

Description : What is return statement in function?

Last Answer : Return Statement : The return statement may or may not send back any values to the calling function(main program). Syntax : return; // does not return any value or return(exp); // the ... function can return some values other than int type, then we must specify the data type to be return.

Description : What are the function variables? (OR) What are the local and global variables?

Last Answer : FUNCTION VARIABLES : They are two types of variables. 1 : Local Variable. 2 : Global Variable. 1 : Local Variable : The local variables are defined within the body of the function or block. These ... variables m' and n' are defined outside the main() function. Hence they are global variables.

Description : What are the function parameters?

Last Answer : PARAMETERS : parameters provides the data communication between the calling function and called function. They are two types of parametes 1 : Actual parameters. 2 : Formal parameters. 1 : Actual Parameters : These ... . . } Where a, b are the Actual Parameters x, y are the Formal Parameters

Description : What is function definition? (OR) what is user defined function? (OR) Write syntax of user defined function?

Last Answer : Function Definition : The program module that is written to achieve a specific task is called function definition. Syntax : type function-name(parameter list) // function header. { declaration of variables; body of function; // ... and b ); scanf( %d%d ,&a,&b); c=a+b; printf( %d ,c); }

Description : What is calling function? (OR) what is function call?

Last Answer : Function Call : The function can be called by simply using the function name. Syntax : function-name(); function-name(parameters); return value = function-name(parameters); Ex : add(); // function ... ,b); // function with arguments. c=fun(a,b); // function with arguments and return values

Description : How to Decleration of function?

Last Answer : Function Declaration (Function Prototype) : Like variable, all functions in a C program must be declared, before they are invoked. The declaration of each function should end with semicolon. Ths is ... : Parameter list declares the variables that will receive the data sent by the calling program.

Description : What is a function? Write advantages of function?

Last Answer : Function: Function means, a large program can be divided into a series of individual related programs called modules. These modules are called functions. A function is a program segment that carries ... efficiency of program. 4 : Function sharing : A function can be shared by many programmers

Description : Mention the categories of instruction and give two examples for each category

Last Answer : The instructions of 8085 can be categorized into the following five • Data transfer MOV Rd,Rs STA 16-bit • Arithmetic ADD R DCR M • Logical XRI 8-bit RAR • Branching JNZ CALL 16-bit • Machine control HLT NOP

Description : Celiac sprue is an example of which category of malabsorption? a) Mucosal disorders causing generalized malabsorption In addition to celiac sprue, regional enteritis and radiation ... malabsorption Postoperative gastric or intestinal resection can result in development of malabsorption syndromes.

Last Answer : a) Mucosal disorders causing generalized malabsorption In addition to celiac sprue, regional enteritis and radiation enteritis are examples of mucosal disorders.

Description : What is an operating system? Explain its functions with an examples. -Technology

Last Answer : It is a program that acts as an interface between the user and the hardware (i.e. for all computer resources). An operating system is an important component of a computer system, which controls and ... users cannot access the system e.g. MS-DOS, Windows 95, Windows XP, Windows Vista etc.

Description : Explain following functions:  getchar( )  putchar( )  getch( )  putch( ) with suitable examples.

Last Answer : getchar( ) - It is function from stdio.h header file. This function is used to input a single character. The enter key is pressed which is followed by the character that is typed. The character that is entered is echoed. ... is to be printed. void main() { char ch='a'; putch(ch) }

Description : 18. Using examples from your area compare and contrast that activities and functions of private and public sectors. -SST 10th

Last Answer : In the private sector, the assets and industries are owned by individuals and in the public sectors industries and enterprises are owned by the Government. Private sector works to earn profits and the ... private sector that we can see around us are IT companies, malls and multiplexes, etc.

Description : Using examples from your area, compare and contrast the activities and functions of the private and public sectors. -SST 10th

Last Answer : This answer was deleted by our moderators...

Description : Using examples from your area, compare and contrast the activities and functions of the private and public sectors. -SST 10th

Last Answer : Public Sector : There are the organisations which directly or indirectly come under the control of government, like MTNL, railways, Indian Airlines etc. Private Sector : In private sector organisations ... the motive of earning profits. BSES and Sahara Airlines are the examples of private sector.

Description : What are two examples of cell specializations found in humans state their functions?

Last Answer : Need answer

Description : Can two functions have the same name? Give examples.

Last Answer : A: Yes. In function overloading and function overriding.

Description : What Are The Three Major Business Functions, And How Are They Related To One Another? Give Specific Examples?

Last Answer : The three major business functions are finance, marketing and operations. Operations entail the production of a product or service and must manage the inputs to production such as workers' time, ... generates sales of the product or service, such as finding customers for the proposed airplanes.

Description : Explain the term taxonomic category.

Last Answer : Explain the term taxonomic category.