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

Change the first argument in a function

I would like to do something like this: function start(){ // Change the first argument in the argument list arguments[0] = '

' + arguments[0] + '

'; // Call log with the new arguments // But outputs: TypeError: Illegal…
Adam Halasz
  • 57,421
  • 66
  • 149
  • 213
4
votes
6 answers

Return several arguments for another function by a single function

This question was closed as exact duplicate since I chose a misleading question title. It was not wrong but suggested an issue often discussed, e.g. in this question. Since the content is about a more specific topic never covered on Stackoverflow I…
danijar
  • 32,406
  • 45
  • 166
  • 297
4
votes
4 answers

while overidding base methods, why default arguments are not working well?

Possible Duplicate: C# optional parameters on overridden methods using System; namespace Apple { class A { public virtual void Func(int a=4){ Console.WriteLine(" A Class: "+a); } } class B : A { …
A.T.
  • 24,694
  • 8
  • 47
  • 65
4
votes
5 answers

Check if Argument is Empty or Not Same

#include using namespace std; int main(int argc,char* argv[]){ if(argv[1] == ""){ cout << "please put something" << endl; }else if(argv[1] == "string"){ cout << "yeah string" << endl; }else if(argv[1] ==…
Mohd Shahril
  • 2,257
  • 5
  • 25
  • 30
4
votes
1 answer

memory cost for using functions as members while calling a function

it's my first post here. I know that the question may seem vague i'll try to be clear... globally without targeting any interpreted language (well i'm using C# currently but i think the answer should work for others too...) I wonder, does this type…
Géry Arduino
  • 490
  • 5
  • 16
4
votes
2 answers

Method in the type is not applicable to the arguments

i've looked through many posts on here and couldn't quite see the solution I need... I'm getting the error: the method initTimer(untitled.Object, String, int int) in the type untitled.TimerClass is not applicable for the arguments (untitled.Toon,…
PsychoMantis
  • 993
  • 2
  • 13
  • 29
4
votes
1 answer

How do to pass variable number of arguments to a function in c++ with no named parameters

I need to write a function which takes a variable number of arguements, its essentially a wrapper around a snprintf like function. I understand how to do this in general as shown in Passing variable number of arguments around. How ever it appears…
Karthik T
  • 31,456
  • 5
  • 68
  • 87
4
votes
3 answers

Find out function arguments value from stack pointer

Given stack pointer value, is it possible to determine the value of the passed arguments to the function? Where are the arguments stored in the stack frame. Lets say, executing gcc compiled ELF binary on x86 architecture on Linux platform: int…
manav m-n
  • 11,136
  • 23
  • 74
  • 97
4
votes
6 answers

Passing multiple arguments via command line in R

I am trying to pass multiple file path arguments via command line to an Rscript which can then be processed using an arguments parser. Ultimately I would want something like this Rscript test.R --inputfiles fileA.txt fileB.txt fileC.txt --printvar…
Omar Wagih
  • 8,504
  • 7
  • 59
  • 75
4
votes
3 answers

Read each character of argument in a batch file

sample input in cmd: test.bat /p 1,3,4 expected result: 1 3 4 my codes so far: @echo off set arg = %1 set var = %2 if (%1)==(/p) ( ... need code that will read and print each character of var )
4
votes
2 answers

c++: function arg char** is not the same as char*[]

I am using g++. I am using code that had a main(int,char**), renamed so I can call it. I looked at Should I use char** argv or char* argv[] in C?, where char** is said to be equivalent to char* []. This does not appear to be true in c++ function…
cvsdave
  • 1,576
  • 2
  • 12
  • 18
4
votes
3 answers

C++: Applying an argument to range of functions

Is there a some more standard way of applying an argument to range of functions? I came up with solutions like the one listed below, but it feels wrong - out there should be something already for building such logic. template
Rado
  • 766
  • 7
  • 14
4
votes
1 answer

pass function arguments from a iterable in Scala?

Is it possible to pass function arguments from a iterable in Scala? val arguments= List(1,2) def mysum(a:Int,b:Int)={a+b} How would one call mysum using the List contents as arguments?
scala_newbie
  • 3,435
  • 2
  • 12
  • 13
4
votes
4 answers

What is the optimum way to fold a function's arguments?

I have a function f that can be called with arbitrary arguments. When it is called with 2 arguments, it performs an operation. When it is called with >2 arguments, it must itself fold the others. That is, when we call f(a,b,c,d), the function should…
MaiaVictor
  • 51,090
  • 44
  • 144
  • 286
4
votes
1 answer

Cannot refer to class template without a template argument list

I'm new to C++. This is for my homework and below is the code that was given to us by the professor to help us work on this assignment but it doesn't compile... I've marked the line where error is generated and the error message is "Cannot refer…
selina
  • 71
  • 1
  • 2
  • 5