Most voted "function" questions
The function (also called procedure, method, subprogram, or routine) is a portion of code intended to perform a single, specific task.
Learn more…1,309 questions
Sort by count of
-
2
votes1
answer132
viewsChar count in C
I have a C function that should take a string, and pointers that have the amount of numbers and vowels that are present in the string, but the function is not adding up each time it finds a number…
-
2
votes1
answer408
viewsQuery vector from one table to update another in C
Hello. I’m new here and I’m not even sure I was objective in the title. But come on. I’m almost done with my final C Algorithms project, and I’m unable to update one item from one table with…
-
2
votes1
answer655
viewsScript for Run in Function
I’m performing a conversion on some comic objects where they are with a fixed name of the database. Example: select * from banco.dbo.tabela ... In this case, we are changing this banco fixed, by a…
-
2
votes1
answer436
viewsEncapsulation, Functions - String function call
I’m having a problem checking if a certain function exists. Code - Similar. if(jQuery){ (function(jQuery){ jQuery.extend(jQuery.fn, { exemplo: function(o){ var chartError = false; function…
-
2
votes2
answers189
viewsPassing by reference in C
In the case of language C, when we want to pass a variable by reference we need to pass its address to the function, I have a question in this case. Take the example: int main(){ int *a; *a = 5;…
-
2
votes1
answer232
viewsWhy should I use File::copy, if PHP already has copy?
I am using the Laravel in various projects that I use. I needed to copy a particular file from one location to another, and I saw in the Laravel documentation that I should use File::copy(). Out of…
-
2
votes1
answer36
viewsJquery - Allow the function to run only when it is not running
I’m having a hard time finding a way to block multiples toggles in my code. That is when the client clicks several times in the toggle field, the field keeps appearing and disappearing several…
-
2
votes1
answer2187
viewsHow to pass a text as a parameter to a Javascript function?
I need to do a Javascript function and I want it to receive the parameters in text format: HTML code: <button onClick="AlteraNome(Felipe)">Enviar Nome</button> Javascript code: function…
-
2
votes0
answers524
viewsFind values with text part
I have a problem, I have a problem spreadsheet. Currently I can do the search by name, but I wanted to type only part of the name, for example, instead of typing "Raquel", type "Ra" he already bring…
-
2
votes2
answers6548
viewsJavascript function calling another javascript function inside a while
I’m having a problem executing a javascript function that in its scope has a while that according to how the counter is incremented, is called a second javascript function passing as parameter the…
-
2
votes2
answers105
viewsWhat would be a parameter call before the string in a function
I’ve seen it done over and over again: interface LoggerAwareInterface { public function setLogger(LoggerInterface $logger); } Put a parameter before the variable, in which case what it would be and…
-
2
votes0
answers43
viewsHow to round a decimal number to another nearest decimal?
So people are having a hard time creating a discount calculator. For example: I want a number x = 2,27 turn 2.3 and x = 2,24 stay 2.2. How to do this?
-
2
votes2
answers76
viewsDetermining when it will be executed
Example: var horaAtual = new Date(); var horaInicio = new Date("Fri Apr 01 2016 23:30:00"); //Quando(horaAtual == horaInicio) //execute algo... I want a function to be executed when it reaches a…
-
2
votes1
answer2796
viewsGlobal variable used in multiple functions
I have this code: donos=[] def calcula_media(): lista_dicionario= [1,2,3] donos.extend(lista_dicionario) def funcao2(): print donos How can I use the global variable in the 2nd function using what I…
-
2
votes2
answers2126
viewsAccess a function’s variable/parameter within another function
I have the following function: function criarDataset(field, constraint, sorFields) { totalTarefasAtrasadas = buscarTarefasAtrasadas(); function buscarTarefasAtrasadas() { usuario =…
-
2
votes2
answers236
viewsFunction SE, SUM or what?
I’m trying to put together a formula, but I know less than the basics about Excel. I made a spreadsheet for sales control, and I put the cakes, sweets, salty, in columns and until then everything…
-
2
votes0
answers203
viewsWhat is the difference between function expression and function definition in relation to Hoisting in Javascript?
What is the difference between function expression (named or unspecified) and function definition in relation to Hoisting no Javascript? Named function expression syntax: var somar = function…
-
2
votes2
answers65
viewsHow to call a function that prints the name of the calling function?
I have the following function: function imprimir(id, nomeFuncao) { console.log('id: ', id, 'Funcão que chamou: ', nomeFuncao) } I want the function imprimir() can print on console.log the…
-
2
votes1
answer215
viewsDefine an array and the type of a function in C
Hello, I am developing a C language boot project, namely the creation of a Multimedia Management System that will have to be able to manage a database of discographic articles such as Cds, Dvds and…
-
2
votes3
answers425
viewsHow to define a function that calculates the lowest speed?
The program must have a function that calculates the lowest speed among those calculated from the data provided. The user must provide as input, 9 values, of 3 in 3, which correspond to speed,…
-
2
votes1
answer995
viewsToo Many Arguments to Function 'address* finds()'
I am trying to compile this code in Devc++ but keeps giving this error [Error] Too Many Arguments to Function 'address* finds()' #include <stdio.h> #include <stdlib.h> #include…
-
2
votes0
answers63
viewsData filter does not load six blocks as in "ALL"
Entering a category does not load six blocks coming from the bank fingered as in "ALL" only those that have already been loaded in all. I need you to press the same in ALL, for each category load…
-
2
votes2
answers1072
viewsFatal error: Call to Undefined Function http_response_code() php 5.2
I took a script (Java android e php) from a book I’m studying, which simply takes a photo sent from android and saved in a folder on my server. The android application ran without any error, but I…
-
2
votes1
answer58
viewsFunction to send AJAX data?
I am trying to set up a function to send an ajax, the function should return my ajax result: var url = localStorage.getItem("site"); var dataForm = new FormData(this); $.ajax( { type: "POST", url:…
-
2
votes2
answers307
viewsCalling function outside the scope in javascript
Follow the code to explain my mistake: class Cliente { showName(name) { alert(name) } getName(){ $.get(minha-url) .done(function(data) { this.showName(data.name) }) } } The getName method returns an…
-
2
votes2
answers1766
viewsDefined function not defined
My function being called during onclick event is not being recognized, this is the console error: ReferenceError: abrirfoto is not defined HTML(only relevant code): <!DOCTYPE html>…
-
2
votes1
answer88
viewsHow to decide the type of a function?
In many C written codes on which I see on the internet I only see type functions void and int Is it possible to declare functions of other types? For example struct and float. I did a simple test…
-
2
votes2
answers1302
viewscall php function in c#
As by c# in Windowsformsapplication call a function from a php page and take the value from it, example: php page: function retornar() { $valor = "aa"; return $valor; } In case I would like to call…
-
2
votes0
answers99
viewswxmaxima. Defining a function of three variables
I’m trying to do some symbolic/algebraic calculations in wxmaxima. But I’m having syntax problems. Question. Let 'n' and’m' be previously stipulated integers. What is the syntax/'command line', as…
-
2
votes1
answer91
viewsConvert path (String) to object
I need a function that converts: "/home/username/Documentos/app.txt" for an object: { "home": { "username":{ "Documentos": "app.txt":{} } } } ` I was thinking of breaking the string by the "/", but…
-
2
votes1
answer802
viewsRead file . txt, send Line and Delete it after confirmation of receipt
This code is the fragment of a method that reads a text file and sends its content line by line, where each sent line receives a confirmation of receipt. I would like to delete from the file the…
-
2
votes1
answer1466
viewsHow to store the return value of a function in a local variable in C?
I created a function that returned a certain value when using this function in the function main of the program, how can I store its return, and for example, display this return in a printf in main?…
-
2
votes2
answers5533
viewsReturn string in C for manipulation outside the function in which it was declared
I must develop a calculator that reads strings in the algebraic form of the complex number operation. I need to manipulate the "main" vector outside the function in which it was declared (receives).…
-
2
votes1
answer86
viewsJS: not defined function error (when calling one function inside another)
I’m having the following error: "my name is not defined" With the structure down: var myobject = object.extend({ init: function () { minhafuncao(); }, minhafuncao: function() { console.log("oi"); }…
-
2
votes2
answers782
viewsReturn of a Javascript function
When I run the following code the commands that were to be returned in real are not. var a = 0; main = function(_this){ console.log('Está entrando em Main'); return function(){…
-
2
votes1
answer505
viewsHow to call a function within a PHP script from the command line
I want to know if I can call a function inside a script from the command line, using for example: $ php script.php minhaFunção() <argumento> in the case, the function is not within a class (it…
-
2
votes2
answers62
viewsPerform function at each given time period
ola i would like to implement a function in my program that performs a task every time having this code as an example something so I am wanting void main(){ while(1){ if(passou 5 minutos){…
-
2
votes1
answer73
viewsjavascript does not create html element and does not add to the page
I’m starting at the javascript and wanted to create html elements dynamically but when you load the page it goes blank and does not add the elements code below: function add (){ var texto =…
-
2
votes1
answer4068
viewsHow to show error message?
I am developing a C# register in Visual Studio and created a method to include a new record in the database. The method is as follows:: public static bool Inserir(Usuario pUsuario) { try {…
-
2
votes2
answers759
viewsUnderstanding parameters and arguments in functions
I am learning programming and I know that there are some answers on this topic, that have made me (theoretically) understand who is the parameter and who is the argument, however still do not…
-
2
votes1
answer48
viewsWrite Dice from one list to another list
T = [0,0,0,1,0,0,0,-1,0] def acoes(T): listaAction=[] for i in T: if(T[i]==0): listaAction.append(T.index(i)) return listaAction print(acoes(T)) How do I write T-list indexes that have value 0 in…
-
2
votes1
answer896
viewsIdentify the type of variable received in a generic function
I have a function in Delphi that receives a kind of generic data, I would like to know what kind of data received, like this: function MinhaFuncao<T>(): T I need to know what kind is in…
-
2
votes1
answer251
viewsFunctions that are nicknames (aliases) should be used or not?
I remember that a while ago, when I was starting programming with PHP, I saw in some tutorials a recommendation, warning that it was to avoid using some functions that are nicknamed for others. I…
-
2
votes2
answers2898
viewsInput the variable
I’m making a simple shipping form. Basically: The user inserts the value to be downloaded, fills in the data and when clicking the confirm button, the result is displayed on the screen. The problem…
-
2
votes2
answers1647
viewsUse of def function
I would like to create a function def to the first input and then return it in the third line. Example: def se(): sex = input('Digite seu sexo:') while sex != 'M' and sex != 'F': #não sei como se…
-
2
votes1
answer1793
viewsSend values on onclick
I’m trying to send two figures on onclick of HTML, however, the second value is "Undefined", as I can send these two values to the function? echo "<h3 id='$input'…
-
2
votes1
answer1397
viewsHow do I correct "indefinite reference to 'function' in C?
Here is a simple example of TAD, which shows the error. file. h #include <stdio.h> #include <stdlib.h> int teste(); file. c #include "arquivo.h" int teste() { int a=5, b=10; return a+b;…
-
2
votes1
answer54
viewsFunction inserting data into the database
I am with this small problem, no matter what I do not right, always keeps giving "invalid query", someone could help me? <?php include('conexao.php'); include('fecha_conexao.php'); function…
-
2
votes2
answers198
viewsPointer changes the value within function in C++
I have the task of creating four functions that do multiplication, division, sum and subtraction between two numbers given by the user. The operation to be performed must be chosen through the * / -…
-
2
votes1
answer105
viewsHow can I compare the data in the same column?
"Create a function (named fn_bo_varios_states) that takes as parameter the code (INTEGER) of a victim and return (TRUE or FALSE) if she has already registered reports of occurrence in more than one…