Wednesday 19 August 2015

What is difference between argument and parameter in .Net

Argument: 
                    An argument is something passed into a function(value).
Parameter :
                       parameter is the type of data + (plus)the name.


Examples of both: 
                        int  Main()
                          {
                             int k=3; int l=5;
                              return mul(k,l);  //here k,l are the arguments
                             }
                           int mul(int x, int y)  // here x,y are the parameters
                            {
                             return x*y;
                            }
explanation : In main method you are passing 3 and 5 those are arguments, mul() takes in two int's. Those are the parameters

                      

No comments:

Post a Comment