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
5
votes
3 answers
Python Multiprocessing And Argument Passing Help Needed
Hi I am trying to run the multiprocessing example in the docs: http://docs.python.org/3.4/library/concurrent.futures.html, the one using prime numbers but with a small difference.
I want to be able to call a function with multiple arguments. What I…

davo36
- 694
- 9
- 19
5
votes
2 answers
What does void *(*routine)(void *) mean in C?
I'm learning C and I came to this expression:
void *(*routine)(void *)
I find it very confusing. Maybe it's a pointer...to a pointer... to a pointer?
If I wanted to pass this thing into a function, how would we manipulate it? I am trying to pass…

PinkElephantsOnParade
- 6,452
- 12
- 53
- 91
5
votes
4 answers
How do I call a function with a variable number of parameters?
How do I call execlp() with a variable number of arguments for different processes?

Nullpoet
- 10,949
- 20
- 48
- 65
5
votes
1 answer
The representation of an empty argument in a "call"
What kind of animal is an empty argument? Consider the following piece of code.
> f <- function(...) match.call()
> l <- as.list(f(,3))
> l
[[1]]
f
[[2]]
[[3]]
[1] 3
> typeof(l[[2]])
[1] "symbol"
> identical(l[[2]],``)
Error: attempt to use…

Evan Aad
- 5,699
- 6
- 25
- 36
5
votes
7 answers
Is using same parameter name and member name valid
Is this valid C++, assuming I want to copy the argument variable to the member variable:
struct Struct {
Struct(const T& value) : value(value) {}
T value;
};
(Update: It works in Visual Studio, but still that might be compiler…

Viktor Sehr
- 12,825
- 5
- 58
- 90
5
votes
1 answer
Functions with a flexible list of ordered/unordered and labeled/unlabeled inputs in MATLAB
A lot of MATLAB functions have an input structure such as:
output = function MyFun(a,b,c,'-setting1',s1,'-setting2',s2,'-setting3',s3)
I am wondering how I should implement this kind of functionality in my own functions. To be precise, I would like…

Berk U.
- 7,018
- 6
- 44
- 69
5
votes
5 answers
JAVA Returning an object or pass by reference
Here a beginners question.
Is there any difference in JAVA between passing an object as argument to a method or returning that object from the method. For instance: Is it better to pass a List as an argument and fill it in the method or just allow…

Altober
- 956
- 2
- 14
- 28
5
votes
3 answers
Pass function as an argument in APL
How do I pass a function as an argument?
The basic idea is something like this (which doesn't work):
∇R ← double a
R ← 2 × a
∇
∇R ← a applytwice f
R ← f f a
∇
5 applytwice double
Is there something like \fun in erlang or function-pointers in C?

Hyperboreus
- 31,997
- 9
- 47
- 87
5
votes
2 answers
Performance when passing huge list as argument in recursive function?
I am using Python and I have a recursive function that takes a huge list as one of the arguments:
# Current implementation
def MyFunction(arg1, arg2, my_huge_list)
...
...
MyFunction(new_arg1, new_arg2, my_huge_list)
As you can see…

geo909
- 394
- 1
- 6
- 18
5
votes
4 answers
C++ how to pass 'this' to pointer reference
i have main class that i like to pass its pointer reference to on of the objects i creating but it gives me error :
Error 1 error C2664: 'GameController::GameController(GameLayer *&)' :
cannot convert parameter 1 from 'GameLayer *const ' to…

user63898
- 29,839
- 85
- 272
- 514
5
votes
1 answer
Pass argument to leiningen readable by project.clj
I have a project.clj file that I want to use differently depending on an argument passed in when called by leiningen. Here is my hypothetical sample project
(defproject simple "0.0.1"
:source-paths [(get-argument "source.path")])
(In this case…

Adam Schmideg
- 10,590
- 10
- 53
- 83
5
votes
2 answers
C# passing generic type to another class
I wanna know is there any way to pass generic type to another Class as an argument.
In other words. I have SomeClass and AnotherClass.
I wanna AnotherClass to have an instance field of Type who would be initialized in constructor.
(I want…

user2184057
- 924
- 10
- 27
5
votes
2 answers
Pass and access structures using objective-c
I want to know how to pass structures to another function and subsequently access that structure in the called function. I'm developing for the iPhone and the reason I'm using structs is so that I can eventually pass data as structs to a server…

Eric de Araujo
- 243
- 7
- 16
4
votes
2 answers
Why is all data that is passed to a function "explicitly passed"?
Data is passed to a function "explicitly" whereas a method is "implicitly passed" to the object for which it was called.
Please could you explain the difference between these two ways of passing data? An example in java or c# would help.

Arthur Mamou-Mani
- 2,303
- 10
- 43
- 69
4
votes
2 answers
Passing argument into backgroundWorker (for use as a Cancel button)
I'm new to C# and object-oriented programming in general. I've been trying to implement a "Cancel" button into my GUI so that the user can stop it mid-process.
I read this question: How to implement a Stop/Cancel button? and determined that a…

Patrigon
- 157
- 2
- 9