C and C++

Actual Arguments And Formal Arguments

Actual Arguments

  • These are the real values or variables you pass to a function when calling it.

  • They appear in the function call.

int main() {
int a = 10, b = 20;
add(a, b); // a and b are actual arguments
return 0;
}

Formal Arguments

  • These are the placeholders or parameters defined in the function definition.

  • They receive the values of actual arguments.

void add(int x, int y) {
printf("Sum = %d\n", x + y); // x and y are formal arguments
}