Argument-passing may refer to two different things: (1) the process of providing a program being started with some initial pieces of information (the arguments) on its command line; (2) the process of providing the initial values (the arguments) for the parameters of a function when it is called.
Questions tagged [argument-passing]
777 questions
4
votes
2 answers
Passing an array to a function with an odd format - "v+last+1"
In The Practice Of Programming, on the chapter regarding quicksort, there is some C code that walks through a basic algorithm for quicksort (I've compiled the code into a program that prints the arbitrary array values pre and post…

rjs
- 838
- 2
- 10
- 21
4
votes
1 answer
How i can dynamically get a Property through a function in c#?
i have a function
public string getValue(string val)
and in this function i need to get the value from a database field:
using (UsersContext db = new UsersContext())
{
UserProfile user = db.UserProfiles.Where(c => c.UserId ==…

Konstantin XFlash Stratigenas
- 605
- 6
- 10
4
votes
1 answer
Introspect function to determine which argument unpacking (positional or keyword) was used
I was searching for a way to identify whether some argument is used for unpacking and I have found this:
>>> def func_has_positional_args(func):
std_args = func.func_code.co_argcount
wildcard_args = len(func.func_code.co_varnames) -…

Tadeck
- 132,510
- 28
- 152
- 198
4
votes
3 answers
How to pass Matlab m x n cell matrix argument in C++ mex function?
I want to pass such a cell matrix created in Matlab as input argument to mex function,
for i=1:5,
p{i}=rand(3,4);
end
and then return it as as an 3 dimensional double array as output argument.
intended syntax:
Parray = convert(p);
where Parray…

LCFactorization
- 1,652
- 1
- 25
- 35
4
votes
3 answers
MouseEventHandler additional parameters - "sender" and "e" cannot be defined
I want to pass an argument to an event handler which I am trying to achieve with this code:
private void openInputImagesToolStripMenuItem_Click(object sender, EventArgs e)
{
...
pb.MouseDoubleClick += new…

c0dehunter
- 6,412
- 16
- 77
- 139
4
votes
1 answer
How to wrap function that takes unlimited number of arguments
I want to wrap an existing function that takes unlimited number of arguments,
e.g. this is the existing function:
function T()
{
$args = func_num_args();
// Do stuff with arguments.
}
I now want to wrap it, e.g.
/*
* This function shall…

JohnSmith
- 4,538
- 9
- 25
- 25
4
votes
1 answer
Intrinsic function as a function argument
Well, this is the issue I've today...
I'm writing a module procedure that has, as an argument, a function. This module looks something like this:
module Integ
implicit none
contains
function Integral(a,b,f)…

Alfonso Santiago
- 531
- 4
- 20
4
votes
2 answers
In what version was the (...) introduced in Lua functions as arguments?
This as the most simple example as I can imagine:
function NewPrint(...)
print("printed:", ...)
end
NewPrint("Hi")
Please note, I haven't actually done Lua for a while, I might have missed some syntax.

Frederik Spang
- 3,379
- 1
- 25
- 43
4
votes
4 answers
Varargs in a group?
About Varargs, can i repeat the arguments in a group?
For instance, i want to allow users pass in:
myFunc(1, "one");
myFunc(1, "one", 2, "two");
myFunc(1, "one", 2, "two", 3, "three");
It seems impossible. But as mentioned in the docs, the varargs…

midnite
- 5,157
- 7
- 38
- 52
4
votes
3 answers
Passing a touch event to all subviews of a View Controller
I have a view controller which creates multiple subviews on top of it. All subviews and the view controller accept touches. How can i communicate the touch point information to all the subviews on the screen? Keep in mind that each subview covers…
Kevin
4
votes
4 answers
Passing a char as an argument in c
I'm just trying to learn c and I'm stuck. I'm trying to create a program that can take an input of two numbers, together with an operator and print out the answer.
The notation is reversed polish notation. That is to say, the input 2 1 + should give…

user1661303
- 539
- 1
- 7
- 20
4
votes
1 answer
Is it always safe to pass empty dict as keywords argument?
Are there any cases where
f(arg1, arg2..., argN)
works and produces a result and
f(arg1, arg2..., argN, **{} )
yields a different result, or causes an error?
I'm assuming that a **kwds doesn't already occur in the argument list.
The context is…

Dave
- 7,555
- 8
- 46
- 88
4
votes
5 answers
Unknown number of arguments in function
I've got the class member:
LineND::LineND(double a ...)
{
coefficients.push_back(a);
va_list arguments;
va_start(arguments, a);
double argValue;
do
{
argValue = va_arg(arguments, double);
…

Sergey Shafiev
- 4,205
- 4
- 26
- 37
4
votes
4 answers
Querying by type in DB4O
How do you pass a class type into a function in C#?
As I am getting into db4o and C# I wrote the following function after reading the tutorials:
public static void PrintAllPilots("CLASS HERE", string pathToDb)
{
IObjectContainer db =…

Faizan S.
- 8,634
- 8
- 34
- 63
3
votes
2 answers
Tcl: How to eval statements to fill in default args at call time
How do you provide default arguments to a Tcl procedure that are evaluated at call-time?
Here's an example of what I've tried:
> tclsh
% proc test { {def [expr 4 + 3]} } { puts $def }
too many fields in argument specifier "def [expr 4 + 3]"
% proc…

cfi
- 10,915
- 8
- 57
- 103