473,657 Members | 2,478 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 6280
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
3692
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 the parameter itself mandatory(combined with a mandatory value, the result is that the user must specify a value). Here's code illustrating my point(see the TODO):
4
1742
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 following error is occurring (VC++ 7.1): error C2663: 'std::_Tree<_Traits>::find' : 2 overloads have no legal conversion for 'this' pointer
14
6705
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 really doesn't feel nice having to miss it out. Is there any reason for them removing this? I don't suppose there's a pragma or something to stop the compiler barking about it is there?
7
2054
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 executed, sMyVariable will have the new value. My solution (if this doesn't exist) would've been to add the value to the resultset (make it part of the Select statement) Thanks.
0
772
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 passed to the subcriber class when the event is fired. The variable types library assembly is referenced in both the publisher and subscriber classes. Could you please help implement this functionality. Thank you, Serge
5
6631
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
4827
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 Funct2(char *chr) // "chr" is a single character variable In both cases, I wish to modify the parameter argument, but it seems to me they are really different data types. Also, is there any way to _override_ the declaration of a function with these 2...
5
15395
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
8413
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8740
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8513
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7352
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2742
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 we have to send another system
2
1970
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.