Questions tagged [function-parameter]

The function parameters are the variable names, listed in the definition of the function.

In many programming languages, parameters are the essence of the functions. The function parameters define the variable names, listed in the definition of the function. They are often confused with (and referred to as) function arguments, which actually are the real values that are passed to and received by the function when it is being called.

314 questions
0
votes
5 answers

function warnings C: "warning: type of ‘char_array’ defaults to ‘int’"

#include #include int myprint(char_array){ char mystring[80]; strcat(mystring, "\n"); printf("%s", mystring); return 0; } int main(int argc, char** argv){ int count = 5; char letter = 'c'; …
codyc4321
  • 9,014
  • 22
  • 92
  • 165
0
votes
1 answer

How does addition function parameters appeared in scala?

I am reading example about monad transformers in scalaz. Here is a piece of code: scala> def myName(step: String): Reader[String, String] = Reader {step + ", I am " + _} myName: (step: String)scalaz.Reader[String,String] scala> def localExample:…
Cherry
  • 31,309
  • 66
  • 224
  • 364
0
votes
2 answers

Objective-C method parameter with ^ symbol

One of the method signature in objective-c code -(void)funcName: (const NSString *)name parameter: (void(^)(ClassName *input)) obj The class definition header file is @interface ClassName : NSObject @property NSObject *data; @end Now how to…
Dickens A S
  • 3,824
  • 2
  • 22
  • 45
0
votes
1 answer

Setting Javascript Function Parameters inside the function parenthesis

This is so simple I forgot how to do it. I've always passed variables to a function hence it's param's were pre-set, now I need to set the param's when declaring the function, but don't remember the setup. I'm looking for the working version of…
0
votes
2 answers

How to call a function stored in a Python class instance variable

I'm passing a function as a parameter to a class constructor. The constructor stores it in an instance variable, and other class methods want to call it. class ComboList(list) : def __init__(self,a,b,kg) : list.__init__(self) …
0
votes
5 answers

Undefined variable : function parameter (PHP)

I'am newbie with PHP and i have a issue with my php form validation that return this error, if the username and the password are not defined. Notice: Undefined variable: username in D:\hpsp\controller\loginvalidation.inc.php on line 64 I use 2…
0
votes
5 answers

python: changing list value in sub-routine

I have a simple example. The function test_list_change should change the list passed to it as a parameter. And inside this function there is a call to sub-routine test_list_change_2 which should change the same list. The problem is, that the result…
Vcitor
  • 53
  • 5
0
votes
0 answers

How and why are function parameter reference kept between calls in Python?

I illustrate my problem with a piece of code: def foo(n, li = []): if len(li) > n: return li li.append(str(len(li))) foo(n, li) return li if __name__ == '__main__': print(foo(2)) print(foo(5)) print(foo(2)) …
steffen
  • 8,572
  • 11
  • 52
  • 90
0
votes
1 answer

Passing member function (non-static) as a parameter to template function

I am trying to define a pointer to non-static member function, and pass the pointer along with class object to a template function, which will again send the member function for template struct operation. It keeps giving me type mismatch errors.…
minsuk ji
  • 23
  • 4
0
votes
1 answer

Error: Initializing Argument 1 of

I've looked around and seen quite a few of these, but none of them provided the solution for my problem. I'm getting this compilation error with the following code: THE ERROR: THE CODE: const int TOP_WORDS = 25; ... void topWords(Hash t,…
user3776749
  • 667
  • 1
  • 10
  • 20
0
votes
1 answer

Non-delimited parameters in function

I've just found a script for progress bars for Photoshop UI the function is set up as a variable in the following form, which I've not seen before. var ProgressBar = function(/*str*/title) Firstly why are the two parameters not separated by a…
Ghoul Fool
  • 6,249
  • 10
  • 67
  • 125
0
votes
2 answers

initializing an passing a string array as a parameter

Can I initiate a string array and pass it as a function that initializes it. I know this sounds redundant, but basically I want to initiate a string array and then pass it to a variable so that I can use it later? Something like this: This is the…
mauricioSanchez
  • 366
  • 10
  • 23
0
votes
2 answers

PHP - Pass arguments into function as array without having to define as parameters

Is there away to pass a variable (with array data) into a function without having to use as a parameter each time I want to use the function? My situation is that I have producing UI elements for a form. Right now if I define the input's name I get…
dvoutt
  • 930
  • 2
  • 9
  • 23
0
votes
2 answers

Scala default function literal parameter

In scala is it possible to provide a default value for a parameter that is a function? For example, in my code I have something like this. def noop(): Unit = {} def doSomethingGreat(succeed: Boolean)(f: => Unit)(default: => Unit = noop): Unit = { …
0
votes
1 answer

How do I specify some parameter while keeping the parameters before it default in php

In functions such as the wordpress function wp_title. I have noticed they can have multiple parameters such as $sep, $display, $seplocation (using wp_title as a example). I know with Ruby on Rails you can change any parameter such as $seplocation by…
8bitedge
  • 3
  • 2