473,506 Members | 16,954 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Difference between parameter and argument

16 New Member
Please tell me the difference between an argument and parameter...i was really confused in understanding the difference between these two.
May 26 '14 #1
6 6256
weaknessforcats
9,208 Recognized Expert Moderator Expert
A parameter is a named value whereas an argument is just a value. For example:

Expand|Select|Wrap|Line Numbers
  1. int function(int x, char y);
Here int and char are parameters while x and y are arguments. The arguments can have any value. The parameter has to be an int.

Another example:

Expand|Select|Wrap|Line Numbers
  1. enum color = {RED, WHITE,BLUE};
  2.  
An enum list like this is a list of named integer values. RED, WHITE, and BLUE above are parameters with values 0,1, and 2. So of all the int values possible only 0,1 and 2 are valid. You use RED instead of 0, WHITE instead of 1, etc.
May 26 '14 #2
donbock
2,426 Recognized Expert Top Contributor
Excerpts from the 1999 C Standard (C99), Section 3 (Terms, definitions, and symbols)...

3.3 argument
actual argument
actual parameter (deprecated)
expression in the comma-separated list bounded by the parentheses in a function call expression, or a sequence of preprocessing tokens in the comma-separated list bounded by the parentheses in a function-like macro invocation.

3.15 parameter
formal parameter
formal argument (deprecated)
object declared as part of a function declaration or definition that acquires a value on entry to the function, or an identifier from the comma-separated list bounded by the parentheses immediately following the macro name in a function-like macro definition.
The difference between parameter and argument is subtle: use the term parameter when referring to the function declaration or function/macro definition; use the term argument when referring to function/macro invocations. The modifiers suggested by the definitions can help to keep them straight: actual argument versus formal parameter.

It looks like the terms were once interchangeable but that later versions of the Standard deprecated interchangeable use of the terms.
May 29 '14 #3
Sherin
77 New Member

Argument

An argument is referred to the values that are passed within a function when the function is called. These values are generally the source of the function that require the arguments during the process of execution. These values are assigned to the variables in the definition of the function that is called. The type of the values passed in the function is the same as that of the variables defined in the function definition. These are also called Actual arguments or Actual Parameters.

Example


Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h> 
  2.  
  3. int sum(int a, int b) 
  4.     return a + b; 
  5.  
  6. int main() 
  7.     int num1 = 10, num2 = 20, res; 
  8.  
  9.     res = sum(num1, num2); 
  10.  
  11.     printf("The summation is %d", res); 
  12.     return 0; 
Parameters

The parameter is referred to as the variables that are defined during a function declaration or definition. These variables are used to receive the arguments that are passed during a function call. These parameters within the function prototype are used during the execution of the function for which it is defined. These are also called Formal arguments or Formal Parameters.

Example

Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h> 
  2.  
  3. int Mult(int a, int b) 
  4.     return a * b; 
  5.  
  6. int main() 
  7.     int num1 = 10, num2 = 20, res; 
  8.  
  9.     res = Mult(num1, num2); 
  10.  
  11.     printf("The multiplication is %d", res); 
  12.     return 0; 
  13.  
Jul 29 '20 #4
Naheedmir
62 New Member
The term parameter is mostly used to recognize the placeholders in the method signature, whereas the term argument is the exact values that you pass into the method.
Jul 31 '20 #5
AjayGohil
83 New Member
Hey,

A parameter is a named variable passed into a function. ... Note the difference between parameters and arguments: Function parameters are the names listed in the function's definition. Function arguments are the real values passed to the function

Difference between parameters and arguments:
  • Function parameters are the names listed in the function's definition.
  • Function arguments are the real values passed to the function.
  • Parameters are initialized to the values of the arguments supplied.

for more information and Example refer following site:

https://www.geeksforgeeks.org/differ...with-examples/
Sep 2 '20 #6
sarbjitgrewal
19 New Member
Yeah, it's confusing for some beginners. Don't worry. I will help you out! A Parameter is a named variable passed into a function definition, whereas arguments are the real values passed to the function.
Sep 4 '20 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

6
3682
by: Frans Englich | last post by:
Hello, In my use of getopt.getopt, I would like to make a certain parameter mandatory. I know how to specify such that a parameter must have a value if it's specified, but I also want to make...
4
1733
by: Dave | last post by:
Hello all, I hope the context to my problem shown below is adequate but not overwhelming. I tried to keep it minimal. At the line indicated (in comment form) in the source below, the...
14
6683
by: Dan | last post by:
Is it just me, or is the removal of support for the word "void" in a parameter list extremely annoying? Some of us have been programming for years putting "void function_name (void)" - and it...
7
2048
by: VMI | last post by:
Can I call a stored proc from .net with a parm that changes during the SP? For example, I call the SP with parameter sMyVariable (which changes in the SP), and when I access it after the SP is...
0
769
by: Autofreak | last post by:
Hello, I am trying to create a public void delegate GenericEventHandler in the event publishing class with a generic parameter. The parameter is of a variable type. The parameter/argument will be...
5
6620
by: puzzlecracker | last post by:
C++ standard says the following: I am reading through c++ standard and have a difficulty understanding the difference between these two terms. Thanks, puzzlecracker
2
4822
by: Mike Copeland | last post by:
How do I distinguish a pointer to a character variable versus a pointer to a C-type character string? For example, void Funct1(char *str) // "str" is a character string variable void...
5
15390
by: cooolsson | last post by:
what's the difference between an argument and a parameter. My friend and i are going nuts over this question.
0
7218
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7307
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7370
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7021
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1532
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
755
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.