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
1 answer

Function as a parameter javascript syntax

I have a function like this : module.exports.download = function (cb) { // Some Code cb(); } Is it the same to do this : module.exports.copyimagefromalbumnext = function (callback) { module.exports.download(callback); } or…
mcbjam
  • 7,344
  • 10
  • 32
  • 40
0
votes
2 answers

How to pass a prompt as an object/function parameter

In Java, I can create variables from prompts, then use a non-default object constructor and pass those prompt variables in as parameters to create a new instance of that object. Is there an equivalent to this in javaScript? example in Java: …
C Morgan
  • 3
  • 1
  • 6
0
votes
1 answer

Why function parameters can not be static

Can anyone please tell me that why the functions parameters can not be static? Is this the reason that function parameters are declared on Stack and gets de-allocated when function return? There is no way to retain parameter values? Just confused.…
Mustansar Saeed
  • 2,730
  • 2
  • 22
  • 46
0
votes
1 answer

Where to put comparison function for use with (e.g.) std::sort?

If I had a class Cell, for example, which I want to sort according to the following function (x and y here being int member variables with accessors): bool sortByCoordinates(const Cell& c1, const Cell& c2) { return c1.getX() < c2.getX() ||…
Quetzalcoatl
  • 3,037
  • 2
  • 18
  • 27
0
votes
4 answers

Accessing data members shadowed by parameters

In Java you can access variables in a class by using the keyword this, so you don't have to figure out a new name for the parameters in a function. Java snippet: private int x; public int setX(int x) { this.x = x; } Is there something similar in…
starcorn
  • 8,261
  • 23
  • 83
  • 124
0
votes
3 answers

Passing array argument to a function

On calling the function int sum_array(int array[], int arr_length) { int sum = 0; while(--arr_length >= 0) sum += array[arr_length]; return sum; } in main function int main() { int b[10]; ... total =…
haccks
  • 104,019
  • 25
  • 176
  • 264
0
votes
2 answers

Understanding Function prototypes

Are the function prototypes int sum_array(int array[], int arr_length); and int sum_array(int [], int arr_length); similar? If yes then, what does int [] mean? Can i define above prototypes by swapping their positions,i.e int sum_array( int…
haccks
  • 104,019
  • 25
  • 176
  • 264
0
votes
1 answer

C#: How can I pass a class to a function in separate dll

I tried to code my own serialization dll. The code itself works as expected. Now I want to put the entire code into a dll file. My problem is the following: how do I tell the dll WHICH class it should serialize? Example: public class serialize { …
0
votes
1 answer

How to register member function with lua-function parameter using luabind?

I need to register a member function using luabind which is supposed to take a lua-function as parameter. For any normal function I would usually just do this: int SomeLuaFunction(lua_State *l) { luaL_checkfunction(l,1); int fc =…
Silverlan
  • 2,783
  • 3
  • 31
  • 66
0
votes
3 answers

php function parameter is not retaining full string passed in

I have a PHP function that in echoing out a string, is losing some of the characters passed in it. Any reason why this would be happening? I pass: $vhkvdov#jqlydk#p*_L#1qrlws|ufqh#KWLZ#1hwdgsX It returns: #jqlydk#p*_L#1qrlws|ufqh#KWLZ#1hwdgsX This…
Tim Kipp
  • 200
  • 1
  • 16
0
votes
3 answers

exec a parameter that is a function javascript

I have an object that contains a lot of arrays inside. This array content function-paramenters. for example: object = {"elem" : [fn1, fn2], "other-elem" : [fn3, fn4, fn5], ... } I want to make a method who receive a name and when this name fixes…
Iban Arriola
  • 2,526
  • 9
  • 41
  • 88
0
votes
2 answers

Changing opacity of DIV within Javascript by passing a function parameter?

I have the following code and I want to change the opacity of the two DIV tags to .5. I cannot seem to get it to work like the width and height. Am I not passing the opacity parameters correctly or is it the part where this newdiv.style.opacity =…
pandoragami
  • 5,387
  • 15
  • 68
  • 116
0
votes
5 answers

C: Function to swap values in 2D array

I'm trying to write a function to swap 2 elements in a 2D array: void swap(int surface[][], int x1, int y1, int x2, int y2) { int temp = surface[x1][y1]; surface[x1][y1] = surface[x2][y2]; surface[x2][y2] = temp; } however when I try to…
Nope
  • 34,682
  • 42
  • 94
  • 119
0
votes
1 answer

Do i need to release parameter in asynchronous function?

I've googled a lot for this, but get no clue for it. First of all, i'm not using ARC. let's say i am calling a asynchronous function, and passing a pointer A to it, initialially i thought, okay, let's pass a autoreleased pointer A to it, the async…
0
votes
1 answer

Use key's value as key in key-value pair in a Javascript function param

Possible Duplicate: Use key’s value as key in key-value pair in Javascript As a followup to Use key's value as key in key-value pair in Javascript function parameter. How can you use the value of a key-value pair as the key in a different…
Eugene
  • 10,957
  • 20
  • 69
  • 97