Functions in C language can be called by two methods:
Call by value basically means passing values between functions when they are called i.e. user provides values to the functions when they are called in the MAIN() function.THese values can either be any constants or variables.
- Call by value
- Call by reference
Call by value basically means passing values between functions when they are called i.e. user provides values to the functions when they are called in the MAIN() function.THese values can either be any constants or variables.
An example illustrating this is given below:
/* Sending and receiving values between functions */
main( )
{
int m, n, p, sum ;
printf ( "\nEnter any three numbers " ) ;
scanf ( "%d %d %d", &m, &n, &p ) ;
sum = calsum ( m, n, p ) ;
printf ( "\nSum = %d", sum ) ;
}
calsum ( a, b, c )
int a, b, c ;
{
int s ;
s = a + b + c ;
return ( s ) ;
}
Output:
Enter any three numbers 11 12 13
Sum = 36
Sunday
//
Labels:
C LANGUAGE
//
0
comments
//
0 comments to "CALLING FUNCTIONS IN C LANGUAGE"
Powered by Blogger.
Blog Archive
-
▼
2011
(50)
-
▼
July
(38)
- INTRODUCTION TO C
- DATA SETS IN C
- DATA TYPES
- VARIABLES
- SIMPLE C PROGRAM
- PROGRAM USING SCANF() AND PRINTF()
- C INSTRUCTIONS
- INTRODUCTION TO DECISION CONTROL STRUCTURES
- IF STATEMENT
- IF STATEMENT PROGRAM
- IF ELSE STATEMENT
- NESTED IF ELSE
- DETERMINING ROOTS OF AN EQUATION
- ELSE IF STATEMENT
- LOGICAL AND ARITHMETIC OPERATORS
- CONDITIONAL OPERATORS
- LOOPS
- THE WHILE LOOP
- The for bend specify things about a bend in a ind...
- EXAMPLE OF FOR LOOP
- NESTING OF LOOPS
- THE ODD LOOP
- THE DO-WHILE LOOP
- BREAK STATEMENT IN C
- THE CONTINUE STATEMENT IN C
- SWITCH STATEMENT IN C
- SIMPLE PROGRAM SHOWING SWITCH STATEMENT
- THE GOTO STATEMENT IN C LANGUAGE
- FUNCTIONS IN C LANGUAGE
- CALLING FUNCTIONS IN C LANGUAGE
- CALL BY REFERENCE IN C LANGUAGE
- POINTERS IN C LANGUAGE
- SIMPLE PROGRAM SHOWING POINTER IN C LANGUAGE
- PROGRAM FOR FUNCTION CALL BY REFERENCE IN C
- SWAPPING OF TWO NUMBERS IN C
- RECURSION IN C LANGUAGE
- FACTORIAL OF A NUMBER WITHOUT RECURSION IN C
- ARRAYS IN C LANGUAGE
-
▼
July
(38)
Post a Comment