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
-
0
votes0
answers34
viewsDifficulty in understanding problem solving
My problem is this; I was solving some exercises of the hacker rank platform and I came across a question that asked me to identify the only value in an array that did not repeat. I couldn’t think…
-
0
votes1
answer38
views -
0
votes1
answer44
viewsHow to write a function that returns appropriate values of a date (day, month and year) so that these are assigned to struct-type variables?
I wanted to develop a function responsible for analyzing the format of the date inserted, however the appropriate values would have to be returned to another function responsible for registering…
-
0
votes0
answers25
viewsArray return in C#
When I assign a function that returns an array to another array, I do not have the corresponding values of each index as assigned within the function. I need to return three percentages that are…
-
0
votes0
answers62
viewsFunction to work when I put import, Function does not work, import does not work
I got into a problem here that I can’t solve the problem and the next: I ran -> npm install fontfaceobserver then went there in the code -- code.js ai pus import --> import Fontfaceobserver…
-
0
votes0
answers51
viewsMake two functions act simultaneously
I need to make a Duck Hunt style game in C is almost everything ready, but we are not able to make the target move at the same time as the projectile, what happens is that we press to shoot, and…
-
0
votes1
answer47
viewsHow to use a variable of an X function in a Y function in Python?
I am a student of the first period of Eng. of Computing I’m having some problems to understand how I could (if possible) use the variable of one function within another, the two being executed…
-
0
votes0
answers14
viewsExecution interrupted
I’m trying to run a script, but the following error is appearing: udunits system database read from C:/Users/André/Documents/R/win-library/4.1/udunits2/share/udunits/udunits2.xml summarise() has…
-
-1
votes1
answer73
viewsUsing a function value
I want to use the value within a function outside of it. I have the global variable, and as it is a variable that is never the same, it presents it. I tested it, and it only worked once with the…
-
-1
votes1
answer490
viewsRead the elements of a struct in another function
I need to access data from struct in my job CalcN, how should I proceed? int main(){ int calcn(); struct user1{ string Nome; int Dnx; int Nxhu; }; struct user1 x; x.Dnx = 4; x.Nxhu = 3; int…
-
-1
votes2
answers291
viewsVariable name passed in function argument
Situation I’m willing to develop this function function ve($var, $dieAfter = false){ $nomeDaVar = ????; echo '<pre>'; echo '$'.$nomeDaVar." = "; var_export($var); echo '</pre>'; if…
-
-1
votes1
answer545
viewsHow to use a Function inside another Function in php?
I need to wear one function inside of another function ... function formata_data( $datacad ){ $datacad = explode(' ', $data); $datacad = $data[0]; $datacad = explode("-", $data); $datacad =…
-
-1
votes1
answer2460
viewsFunction in Mysql for sending EMAIL
I want to shoot some email to some clients I have registered in a table, I did not want to develop an application to run this task, I would like to do directly in the data group, is it possible to…
-
-1
votes1
answer49
viewsHelp in function with pointers
Can anyone help me with this code ? not working, can’t find the error. #include <stdio.h> int chamar(int *n){ printf("Digite o valor de n:"); scanf("%d",&n); printf("%d",n); return 0; }…
-
-1
votes2
answers54
viewsWhat function to use
As a beginner in Excel, I’m having difficulties to use a function that I believe is the solution to what I want, the function (SE). The thing is, I have a sum of values that start at 54 and go to…
-
-1
votes3
answers105
viewsHow to reuse this js in other elements
I do not have much knowledge in JS, but I got this function that does exactly what I need, but when I duplicate the html div that uses this same function js it does not work, I had seen somewhere…
-
-1
votes2
answers74
viewsgetDate() from Javascript returning NULL
(function(){ var data = new Date(); var dia = document.querySelector('.table tbody tr > td'); dia.textContent = data.getDate(); })(); I have this function in Javascript. It always returns NULL.…
-
-1
votes2
answers434
viewsPass the value of a Function post to another Function?
$(function(){ $("#for").submit(function() { var situa = null; $.post("url", {dado: "campo"}, function(val) { if(val == 1){ situa = 'você não foi selecionado'; }else{ situa = 'você foi selecionado';}…
-
-1
votes2
answers1121
viewsReceiving an array as a parameter in a PHP function
Well, the subject may be old, but that doubt has arisen, not patience in rewriting the code... The following code is not generating a result. There’s a function that’s basically like this: function…
-
-1
votes2
answers38
viewsHow to make constant member functions in Php?
I was studying what my book called "constant member functions" in C++. i.e., functions that cannot change any class attribute or call other methods that are not constant. So, I made this code in…
-
-1
votes2
answers381
viewsHow to create several variables of the same type without repeating conditions?
import java.util.ArrayList; import java.util.Scanner; class Main { public static void main(String[] args) { Categoria c1 = new Categoria(); c1.categoria = "-Reprodução"; c1.nome = "Ahmed Shafik";…
-
-1
votes1
answer40
viewsPersonal a problem that seems very silly about the PHP connection
I’m starting basic API for personal use, but at first I’ve come across a little problem that my eyes didn’t notice the origin: Warning: mysqli_connect() expects Parameter 1 to be string, Object…
-
-1
votes1
answer164
viewsPass vector as argument to a function
I’m trying to pass a vector to a C function, but I don’t know what I’m doing wrong. Since the code is small, I’ll post in full: #include <stdio.h> int calcula(double A){ if(A<=10.0){…
-
-1
votes2
answers266
viewsHow to add functions in C programs?
I need to know how to introduce functions into any program. If someone can give me an example in this program here, maybe I can apply it to others as well. I need to understand the logic of how to…
-
-1
votes3
answers646
viewsPYTHON FUNCTION(METHOD)
Well I am trying to create a register program in python, but a simple one only to test what I have learned, but I have a problem, I created a function and I return and then store in a variable but…
-
-1
votes1
answer122
viewsProblem with passing parameters/return of function matrices in C
I’m having a problem with a job I have to do in C consisting of, get the inverse matrix through the adjunct matrix. So far this is what I’ve been able to produce in C# and then tried to rewrite in…
-
-1
votes3
answers312
viewsCould help me count the number of characters in a word in PHP
Well, I need to count the number of characters of a word in PHP, but without using strlen and also any other type of specific function, the point is that I don’t know how to do it. Could someone…
-
-1
votes1
answer3875
viewsHow to Insert HTML Code within Javascript?
I have this code, I’d like to know if it’s correct the way it is? Javascript code: function texto(){ if(SONome == 'Windows 10 x32'){ window.location.href =…
-
-1
votes1
answer28
viewsParameter over 16 javascript error characters
I’m trying to pass a variable by an onclick function but when I see the return is not coming the whole value, as below: $("#nomePromocao").append("<tr><td><button…
-
-1
votes1
answer739
viewsCreate Function to update column
I need to update a column according to the contents of the other two columns, for example, I have two tables, the table suprimentos and the table estoque, Table supplies codigoSuprimento…
-
-1
votes3
answers44
viewsSend form without knowing the name
I have a form that changes its name constantly , and I want to give it Ubmit for a function. In this function "alters" it takes the name of the form, but this way I did it does not work. The "+ide+"…
-
-1
votes2
answers1495
viewsSQL Server Function - Holidays
Good afternoon! Dear friends, I have the following function below that is the days not worked that are coming only Saturday and Sunday, however, I wanted to include in this function the holidays.…
-
-1
votes2
answers145
viewsWhat I’m missing in this Form Calculating IMC in Javascript
<script type="text/javascript"> function calcula_imc(){ var altura = document.imcForm.altura.value; var peso = document.imcForm.peso.value; var quadrado =…
-
-1
votes2
answers145
viewsWhy use three parameters for this`callback`function?
I’m learning Javascript, and I was recreating the type function forEach (wearing a bow tie for) inside prototype of a array. And for that I used a function callback, down below:…
-
-1
votes1
answer117
viewsWhy is the Sumary function returning Undefined?
When the function console.log(contas.sumario()) class CicloFinanceiro is called, appears the two objects as if expected and then appears Undefined and do not understand why. class Lancamento {…
-
-1
votes1
answer450
viewsHow to do a pointer struct for a function that prints the struct itself in C
I have a structure: struct conteudo{ tipo valor; //valor qualquer void (func*)(void*); //ponteiro para função que imprime a propria estrutura }; I would like to know how to call this function to the…
-
-1
votes3
answers259
viewsProblem with recursive function, 2 parameters
I’m trying to write this code using recursiveness: #include <stdio.h> #include <stdlib.h> #include <locale.h> int potencia(int i, int j) { return (j > 0) ? 1 : (potencia(i , j)i…
-
-1
votes1
answer28
viewsProblems in the execution of a function
I was trying to create a Python function that would display only even numbers within a range of numbers, until it works and displays numbers, but it also displays 'None' where, I imagine, the odd…
-
-1
votes2
answers224
viewsFunction values returning Undefined in Javascript
var const1 = function (a,b,c,d){ return (a*b+c-a)/d; { const1(10, 2, 2, 10, 2); console.log('a = ' + const1.a); console.log('b = ' + const1.b); console.log('c = ' + const1.c); console.log('d = ' +…
-
-1
votes1
answer38
viewsFunction returning Nan
Well I am trying to execute this function and results in Nan, not even an error in the console. var numeros = [10,2,5,,30,25,19,20,50,40,150] function media(nums) { var tam = nums.lenght var soma =…
-
-1
votes1
answer53
viewsWhen mysql_fecth_assoc, don’t you think, it kills the rest of the code, how do you make it return something?
Hello, I have a problem in this function when deleting, I do a search of what will be compared, and put two delete condition, because I need it to delete in one condition two tables, and if there is…
-
-1
votes1
answer127
viewsHow to include "space" on cards
I need to include spaces between the person’s title, name and surname. function cartao(titulo, nome, sobrenome) { return titulo + nome + sobrenome } The result of this is: Dr.Matheuspeixoto without…
-
-1
votes1
answer174
viewsI need to count the prime numbers to a certain number n
Write the n_primes function that takes as argument an integer greater than or equal to 2 as parameter and returns the number of primes that exist between 2 and n (including 2 and, if applicable, n).…
-
-1
votes1
answer16
viewsProblem with function Undefined return
Good evening, I made the following algorithm in Javascript: var res = 1; console.log(fatorial(3)); function fatorial(n){ if(n == 1){ console.log(res); return(res); }else{ res *= n; fatorial(n - 1);…
-
-1
votes4
answers261
viewsGenerate 7 random dozens using javascript and loop for? How to do?
This is my code: function gerarDezenas() { var dezenas = ["d1","d2","d3","d4","d5","d6"]; for (var i = 0; i < dezenas.length; i++) { Math.random()*60 dezenas[i] = Math.round(Math.random() * 60…
-
-1
votes1
answer22
viewsas variable return within a function
Function getPeson () { const name1 = 'Vagner'; const Nome2 = 'Jessica'; Return name1, Nome2; } console.log(getPeson());
-
-1
votes3
answers81
viewsConfusing behavior in changing the value of variables in js functions
Why time1 print 3 and time2 print 2? let gols = 1 const time1 = function () { console.log(gols) gols = 2 } gols = 3 const time2 = function () { console.log(gols) } time1() // 3 time2() // 2…
-
-1
votes1
answer30
viewsI’m making a calculator and I can’t display the results
I’m basically turning a rundown of Excel formulas into a calculator that will appear on a Landing page. I did all the logic of the calculations, but I don’t know exactly what I had to do to connect…
-
-1
votes2
answers41
viewsDoubt about functions in php
A function only works if we call it in some file or it will work anyway? For example, to pass the value from one variable to another in the processing file, I know I must call the function to give…
-
-1
votes1
answer18
viewsHow to separate in x and y being all but the last x and the last y?
I am doing a function to generalize a train_test_split, and for that desire separates within the function the X and the y. Currently my code is like this: python def split(dados): SEED = 42367 X =…