top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What are different types of arguments?

+1 vote
322 views

Explain the different types of arguments

posted Nov 21, 2014 by Roshan

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+2 votes

I think it is
1. Actual Arguments
2. Formal Arguments

For example -> In the function call "sum(x,y)" , x& y are actual arguments.

And in the function definition "int sum(inta, int b)" , a& b are the formal arguments.
By default the formal arguments are of register type of storage class & are stored in the internal CPU registers for faster access of data.

The actual arguments are stored in the stack section so they may belong to auto type of storage class by default.

Hope this helps!!

answer Dec 2, 2014 by Ankush Surelia
+1 vote

A parameter is a variable used during the declaration of the function or subroutine and arguments are passed to the function, and it should match with the parameter defined. There are two types of Arguments.
Call by Value – Value passed will get modified only inside the function, and it returns the same value whatever it is passed it into the function.
Call by Reference – Value passed will get modified in both inside and outside the functions and it returns the same or different value.

answer Nov 21, 2014 by Manikandan J
Similar Questions
+2 votes

Input iterators, Output iterator, Forward iterator, Random access iterators and Bidirectional iterators.
Can someone please explain the differences ?

0 votes

I am experimenting a bit with exactly how much is (user-wise, anyways)
conveniently implementable with C+11 variadic templates and a strict
construction/destruction pattern. In addition I use this project for a
playground for other techniques, such as designing everything through
composition and mixins, as well as the occasional functor, for maximum
flexibility. Repository: https://github.com/lycantrophe/Curses-- [1]

So far so good, but all currently implemented widgets have been very
basic and only wrapped around the Widget class. What I am having trouble
with is the "ButtonGroup" widget.

This widget is, as the name suggests, a group wrapper for the Button
class that handles things such as a common return value, behaving like
an external entity towards user code and, most importantly, being
responsible for handling input and focus switch between the buttons in
the group it governs.

What I am trying to accomplish is being able to forward a set of
arguments to the individual, underlying buttons. These parameters
include text value (the string to be displayed), individual return
values and individual anchors. Things like border style and behaviour in
regard to focus toggle will of course be shared between all buttons.
Some code to clarify:

 template< typename Return >
 class ButtonGroup {
 ButtonGroup();
 ButtonGroup( const Anchor

 template< typename Action, typename... Args >
 ButtonGroup(
 const std::initializer_list< std::string >& texts,
 const std::initializer_list< Action >& actions,
 const std::initializer_list< Anchor >& anchors,
 const Args

 Return trigger();
 void redraw();

 private:
 std::vector< Button< Return > > buttons;
 typename std::vector< Button< Return > >::iterator current;

 };

Return is the return value from the buttons (typically true/false, but
can be anything). Action is a template as it requires a functor, whereas
bool is treated as a special case (simply creates a functor for you).

This did not work; both gcc and clang/llvm were unable to properly
deduce my use of initializer lists (from the ButtonGroup( const Anchor
to provide me with a vector, array or whatever suitable structure
that holds:
[ Button( "OK", true, Anchor( 0, 0 ), Button( "Cancel", false, Anchor(
0, 3 ) ) ], from here on [ Button, Button... ].

Sending the arguments in a structured matter, such as grouping all
strings, all return-values and all anchors would be fine as well. Now,
it is NOT acceptable to take the actual Buttons (or pointers, for that
matter) as arguments during construction as this would require double
construction and, as you probably see from the other construction code,
defeats the purpose of this style.

Are there any ways I can try to accomplish this? Any other criticism
will be welcome as well.

...