C Formal and Actual Arguments - onlinetutorialspoint

PROGRAMMINGJava ExamplesC Examples
Java Examples
C Examples
C Tutorials
aws
JAVAEXCEPTIONSCOLLECTIONSSWINGJDBC
EXCEPTIONS
COLLECTIONS
SWING
JDBC
JAVA 8
SPRING
SPRING BOOT
HIBERNATE
PYTHON
PHP
JQUERY
PROGRAMMINGJava ExamplesC Examples
Java Examples
C Examples
C Tutorials
aws
In this tutorial, we are going to learn about two types of function arguments.
An argument is an expression that is passed to a function by its caller in order for the function to perform its task. It is an expression in the comma-separated list bound by the parentheses in a function call expression.
A function may be called by the portion of the program with some arguments and these arguments are known as actual arguments (or) original arguments.
Actual arguments are local to the particular function. These variables are placed in the function declaration and function call. These arguments are defined in the calling function.
The parameters are variables defined in the function to receive the arguments. Formal parameters are those parameters that are present in the function definition. Formal parameters are available only within the specified function. Formal parameters belong to the called function.
Formal parameters are also the local variables to the function. So, the formal parameters are occupied memory when the function execution starts and they are destroyed when the function execution completed.
Let us consider the below example:
#include <stdio.h>
int add(int, int);
void main() {
  int P = 10, Q = 20;
  printf("Sum of two numbers = %d\n", add(P, Q)); // variables P, Q are called actual arguments
}
int add(int A, int B) { // variables A, B are called formal parameters
  return(A + B);
}
Output:
Sum of two numbers = 30
In the above code whenever the function call add(P, Q) is made, the execution control is transferred to the function definition of add().
The values of actual arguments a and b are copied into the formal arguments A and B respectively.
The formal parameters A and B are available only within the function definition of add(). After completion of execution of add(), the control is transferred back to the main().
Wiki – Parameters and Arguments
C fucntions
Happy Learning 🙂

C – Categories of Functions
Basics of C Pointers | Call by value | Call by address
User defined Functions in C
C How to Pass Arrays to Functions
C Pointers with Arrays
How to pass Command line Arguments in Python
C Local and Global Variables
Dynamic Memory Allocation in C
Different ways to use Lambdas in Python
Python Decorators – Classes and Functions
What are Python default function parameters ?
PHP Variables Example Tutorials
PHP Functions Example Tutorials
Understanding Scope & Lifetime of Variables
Lambda Expressions in Java

C – Categories of Functions
Basics of C Pointers | Call by value | Call by address
User defined Functions in C
C How to Pass Arrays to Functions
C Pointers with Arrays
How to pass Command line Arguments in Python
C Local and Global Variables
Dynamic Memory Allocation in C
Different ways to use Lambdas in Python
Python Decorators – Classes and Functions
What are Python default function parameters ?
PHP Variables Example Tutorials
PHP Functions Example Tutorials
Understanding Scope & Lifetime of Variables
Lambda Expressions in Java
 


Δ
 C – Introduction
 C – Features
 C – Variables & Keywords
 C – Program Structure
 C – Comment Lines  & Tokens
 C – Number System
 C – Local and Global Variables
 C – Scope & Lifetime of Variables
 C – Data Types
 C – Integer Data Types
 C – Floating Data Types
 C – Derived, Defined Data Types
 C – Type Conversions
 C – Arithmetic Operators
 C – Bitwise Operators
 C – Logical Operators
 C –  Comma and sizeof Operators
 C – Operator Precedence and Associativity
 C – Relational Operators
 C Flow Control – if, if-else, nested if-else, if-else-if
 C – Switch Case
 C Iterative – for, while, dowhile loops
 C Unconditional – break, continue, goto statements
 C – Expressions and Statements
 C – Header Files & Preprocessor Directives
 C – One Dimensional Arrays
 C – Multi Dimensional Arrays
 C – Pointers Basics
 C – Pointers with Arrays
 C – Functions
 C – How to Pass Arrays to Functions
 C – Categories of Functions
 C – User defined Functions
 C – Formal and Actual Arguments
 C – Recursion functions
 C – Structures Part -1
 C – Structures Part -2
 C – Unions
 C – File Handling
 C – File Operations
 C – Dynamic Memory Allocation
 C Program – Fibonacci Series
 C Program – Prime or Not
 C Program – Factorial of Number
 C Program – Even or Odd
 C Program – Sum of digits till Single Digit
 C Program – Sum of digits
 C Program – Reverse of a number
 C Program – Armstrong Numbers
 C Program – Print prime Numbers
 C Program – GCD of two Numbers
 C Program – Number Palindrome or Not
 C Program – Find Largest and Smallest number in an Array
 C Program – Add elements of an Array
 C Program – Addition of Matrices
 C Program – Multiplication of Matrices
 C Program – Reverse of an Array
 C Program – Bubble Sort
 C Program – Add and Sub without using + –