0

Hello sir..
I want to know that if there is any difference between Parameter and Argument of a function
....?

2
Contributors
1
Reply
3
Views
7 Years
Discussion Span
Last Post by creeps
1

A parameter is used when defining/declaring (or prototyping) a function, and an argument is passed (or given) when calling the function. In the example below, x and y are parameters, while a and b are arguments:

double average(int x, int y); /* Function prototyping; x and y are parameters */

int main(void) {

    int a = 10, b = 20;

    printf("%d\n", average(a, b); /* The function is called; a and b are arguments */
}

double average(int x, int y) { /* Function definition; x and y are parameters */

    return (x + y) / 2;
}

Edited by creeps: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.