Questions tagged [arguments]

An argument is a value passed to a function, procedure, or command line program. This also refers to the Array-like `arguments` object in JavaScript.

An argument is a value passed to a function, procedure, or program. It is often used interchangeably with the word "parameter", which also has more specific definitions. Usually "argument", or "actual parameter" (as opposed to "formal parameter") is the value of the parameter used within the called routine.

In other words, parameters are used in procedure definitions, and arguments are used in procedure calls.

arguments can also refer to the Array-like object in JavaScript that is available inside functions, this object can be used to access all of the function's arguments regardless of the function's signature.

11091 questions
4
votes
1 answer

Run shell script with arguments using nohup

I need to do remote login to a server and run a shell script with arguments in the background using nohup. But I am getting an error. Am I missing anything in syntax? Mycode: ssh -t -t user@servername nohup /path/myscript.sh argument1 argument2 & >…
Jill448
  • 1,745
  • 10
  • 37
  • 62
4
votes
1 answer

C++: how to pass a variable as an argument to class constructor

I am faced with a very puzzling issue. I am trying to construct an object using a variable as a parameter. Have a look at this code please: #include class A { public: A() : val(0) {}; A(int v) : val(v) {}; private: …
user2664344
  • 179
  • 2
  • 6
4
votes
4 answers

Questions on how passing arguments works in C++

So I am a fairly experienced C programmer who has to program in C++ a lot. There are some subtleties about the language that I have never felt to confident on. For example, the best methods of passing arguments. Suppose for example, that I have a…
sicklybeans
  • 299
  • 3
  • 11
4
votes
2 answers

How to access literal wildcard argument before it's expanded to matching files?

Background: I'm writing a bash script that must receive these arguments: a file name (a file containing a set of rules ) a list of file names ( files to be processed, can use wildcards) a destination folder ( where processed versions of files will…
Tulains Córdova
  • 2,559
  • 2
  • 20
  • 33
4
votes
2 answers

Can a function be passed as an argument in PHP?

I am wanting to pass a functon as an argument using PHP, in the equivalent way that jQuery allows passing of functions. jQuery: $("#foo").bind("click", function(){ alert("Hello world!"); }); So, I tried this using PHP: $arg1 = "Hello"; $arg2 =…
user2637824
4
votes
3 answers

python reduce error?

The following is my python code: >>> item = 1 >>> a = [] >>> a.append((1,2,3)) >>> a.append((7,2,4)) >>> sums=reduce(lambda x:abs(item-x[1]),a) Traceback (most recent call last): File "", line 1, in TypeError: () takes…
Charlie Epps
  • 3,595
  • 9
  • 33
  • 38
4
votes
0 answers

Objective-C callstack and arguments access

Is it possible to access arguments for caller and caller-of-caller via Obj-C runtime. I only found: NSLog(@"%@", [NSThread callStackSymbols]); I know it is possible, but is there any instruments (API) ? UPDATE 1: Maybe we can analyze [NSThread…
k06a
  • 17,755
  • 10
  • 70
  • 110
4
votes
1 answer

batch file send current folder inside a quoted argument

I have a batch file for converting images, arguments are quotes, and quotes strings inside the argument are escaped. However, I want to send the current path %CD %also as an argument... but executing this: "C:\Program Files\GIMP 2\bin\gimp-2.8.exe" …
lode
  • 504
  • 6
  • 21
4
votes
1 answer

Two-Dimensional Array as Function Argument

How can I pass a two-dimensional array as an argument of a function (considered that the size of the array is known)? I will need help for both the declaration and the definition of the function. What I have in mind is something like this: #include…
user2276872
4
votes
2 answers

c++ passing function as argument to another function with void pointer

I'm trying to pass a function as argument to another function with void pointer and it doesn't work #include using namespace std; void print() { cout << "hello!" << endl; } void execute(void* f()) //receives the address of print { …
Ricardo Zorio
  • 282
  • 5
  • 11
4
votes
6 answers

(Python 2.7) Use a list as an argument in a function?

So I'm trying to learn Python using codecademy but I'm stuck. It's asking me to define a function that takes a list as an argument. This is the code I have: # Write your function below! def fizz_count(*x): count = 0 for x in…
Taint
  • 67
  • 1
  • 1
  • 10
4
votes
6 answers

Too many constructor arguments in deepest class of inheritance?

I want a general solution on how to avoid insanely high number of constructor arguments. The examples I'm providing here are just examples, and I don't want a specific answer for the exact example here. That being said, my problem is obviously…
Skamah One
  • 2,456
  • 6
  • 21
  • 31
4
votes
2 answers

Invalid arguments in classes

char* n=m.getName(); I get the following error Invalid arguments ' Candidates are: char * getName() ' for the above instruction.What am I missing? char* Medicine::getName() { return this->name; } name is of declared as char name[50]; andm is…
Matt
  • 484
  • 5
  • 15
4
votes
2 answers

How to pass two dimensional array to a function in F#?

I am trying to create a function in F# that takes as input a two dimensional array of integers (9 by 9), and prints its content afterwards. The following code shows what I have done : let printMatrix matrix= for i in 0 .. 8 do for j in 0…
John
  • 627
  • 10
  • 18
4
votes
1 answer

What mode must I specify to argparse.FileType to append, keeping - as a default

I have to write a program with this command line : demo.py [-h] -f FILENAME [-o] The filename is mandatory and means that the file we be appended to. The -o flag means that the file will overwritten. This argparse code almost works : import…
ixe013
  • 9,559
  • 3
  • 46
  • 77