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
1
vote
5 answers

VB "Optional" equivalent in C#

Is there a Optional in C#? Sub notify(ByVal company As String, Optional ByVal office As String = "QJZ") How would you implement the above code in C#? I have seen optionalstr optionalint but what about other datatypes and custom object?
Flood Gravemind
  • 3,773
  • 12
  • 47
  • 79
1
vote
2 answers

Max length for a function parameter

Is there any max length for a JavaScript function() parameter? I created a function which had a long parameter, but it didn't work. When I shortened the parameter of the same function, it worked. Does that mean that there is a maximum length for a…
shadyinside
  • 630
  • 1
  • 8
  • 23
1
vote
3 answers

JavaScript: Define variable name with function parameter

Is it possible in JavaScript to define a variable name with a function parameter? Here is my jsFiddle. In the example below, I would like varB to be defined as null when it is passed through makeNull(varName): var varA = undefined; if (varA ==…
0
votes
1 answer

Functions with parameters in TASM

Could you please post an example in assembly language that uses functions with parameters. Something simple, like function that returns a sum of two elements. Couldn't google any example that is simple enough. ADDED: .model small .data .stack …
Sergey
  • 47,222
  • 25
  • 87
  • 129
0
votes
5 answers

Char has a different size than a string

I was working with a program that uses a function to set a new value in the registry, I used a const char * to get the value. However, the size of the value is only four bytes. I've tried to use std::string as a parameter instead, it didn't work. I…
Griffin
  • 644
  • 6
  • 18
0
votes
3 answers

Can $(this ) object be used to point to a function

I have a code something below: function showHideOptions() { $("#template1, #template2, #template3, #template4").css("display","none"); $(this).css("display","block"); } And I have four select dropdowns, At a particular time I…
Mike
  • 3,348
  • 11
  • 45
  • 80
0
votes
2 answers

C Use an array variable in a function parameter?

I have a 2D array of strings char* d2Array[valueA][valueB]. This works fine, I am able to fill it with strings and access them. There is an issue when passing it to a function. You need to specify the second size parameter (i.e. void aFunction(char*…
0
votes
2 answers

Function that receives a function and a "default parameters" key-value object and returns another function with default arguments set

That sounds kind of complex. The idea here is to write the method "defaultMethod". It receives a function and an object. If the function is a simple add: function add(a,b) { return a+b;}; When calling var add_ =…
0
votes
1 answer

How to avoid using global variables when coding a game in C with the betty style?

I am new to coding and started off with C. I am trying to recreate the famous Snake game and currently using the betty style of coding. Apparently global variables are not allowed and so far What I have thought of is passing my variables as function…
Johnny
  • 13
  • 2
0
votes
1 answer

SQL Server make table as a function parameter

I have this function, and I want to make the table '[SEJ_Reservation]' as a parameter to the function, to be able to use the function with another table, the function as below : CREATE FUNCTION [dbo].[fn_Inhouse]() RETURNS @TEM_INHOUSE TABLE (LogID…
0
votes
0 answers

Find valid texts in a text file using RegEx

I have a text file that I am searching for specific lines of code by using a PHP program. In this example it is " $this->t() ". I would like to find out what is in the brackets using RegEx. Normally a ~->t\((.*?)\)~ would be good enough, but there…
LoB
  • 33
  • 4
0
votes
0 answers

Kotlin: mark function argument after sanitizing it into a new variable as "do not use this anymore"

To start: this question is already kind of resolved for me. But the discussion might be interesting. I like code so let's look at this function: fun foo(path: Path) { val absPath = path.normalize().absolute() // sanitizing …
Stefan
  • 1
  • 1
0
votes
1 answer

How do I use an equation as an argument in a function?

I have a an equation that i want to use as an argument in my function, the catch is i want to have it within my function without defining any of its variables. The idea is once have it inside my function i can manipulate the vars...sort of like a…
hghebrem
  • 5
  • 2
0
votes
1 answer

Why copy intialisation is used instead of direct initialisation when passing argument to function parameter by value

I am learning C++ using the resources listed here. In particular, I came to know that copy initialization is used when passing arguments to function parameters(by value) etc. For example, from decl.init.general#14: The initialization that occurs in…
0
votes
1 answer

Passing Class object as Global Param

I'm trying to pass a class object as an argument to a global function. Here's the function: def CreatePlayers(p1_Name, p2_Name, cardDeck): #Function to Create Players #Takes 3 variables: Names of player 1 and player 2 and the card deck …