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
-
1
votes1
answer62
viewsEmpty vector displays the final result of the function
I am doing tests with array/vector and, as first display of the vector should be shown empty, as second, would come full. What is the problem, why it occurs ? and how can I correct ? <ul>…
-
1
votes1
answer54
viewsCarousel rotation, cannot read null "style" property
Well, I am trying to make a Carousel in JS vanilla, however, there is an error when creating the script part for the Carousel rotation JS //Cada Carousel var bannersHolders =…
-
1
votes0
answers32
viewsCan I pass a string, which is not previously stored in an array, as a parameter for a function?
I wrote this function to remove the characters nay repeated from any string in c: char *repeticoes(char *s){ int i=0, j, cont=0; while(s[i]!='\0'){ for(j=0;j<strlen(s);j++) if(s[j]==s[i] &…
-
1
votes2
answers688
viewsHow to save an object (JSON) by copying in Javascript
How to store the current state of a json object per copy? Because if I save by reference I lose the exact information of the object at that moment of assignment. Object example: var sessao =…
-
1
votes1
answer86
viewsDifference between closures and functions
Closures is a Function in Groovy ? There is some difference between them?
-
1
votes1
answer3860
viewsRecursion in C: Sum
I’m learning Recursiveness in C and need to make a recursive function that returns the sum of a number n whichever. The prototype of the function is float somatorio(int n) and the sum to be…
-
1
votes3
answers5789
viewsCheck whether a date is valid in C or not?
I need to check if a date is valid or not in C, and for this I will have a function called verificarData that will be passed to it the user input and will check whether or not it is a valid date.…
-
1
votes1
answer93
viewsHow do the main function inputs work in C?
I’ve always used the main function as follows, creating other functions: int main() { . . . return 0; } How the inputs to the main function work? int main(int argc, char **argv){ We have a variable…
-
1
votes0
answers101
viewsFunction with Enum - TYPESCRIPT
Good need to put a function in an Enum in typescript as in the example below: export enum dataTableFunc{ 'edit'= teste() } function teste(event.button){ // } In this Function that I am trying to…
-
1
votes1
answer32
viewsCan’t it be used as a function?
I’m creating a program that sorts some numbers from a vector, so it’s a bubble sort. I’m using a function called trocar to exchange seat numbers when one is larger than the other, but the compiler…
-
1
votes2
answers9247
viewsHow to check if one string is contained in another in C?
I have two variables: char s1[20]; char s2[20]; I’ll go get the input user of the two variables, and after this, I need to check whether s1 is contained in s2, even a part of it. For this I will use…
-
1
votes0
answers98
viewsThe Map (google maps API - javascript) stops working when I add a function in the script!
The map stops when I put the Connect function, when I remove it the map will appear again as always var map; var markers = []; function initMap() { map = new…
-
1
votes1
answer46
viewsOpen files that will be shared between various functions, inside or outside the functions?
Next, I’m making a program that I’m going to divide between the function module and the interface, and I need to use files in this project (and I can’t use classes), it turns out I need to use these…
-
1
votes1
answer408
views -
1
votes0
answers25
viewsReflections with Kotlin
I need to compare a Kparameter with a Kclass, know if the type of the parameter is equivalent to my Kclass. So far I have not found a saint to do this, someone has my solution?
-
1
votes3
answers1242
viewsPoint inside a polygon
I need to create a function that checks if a point is inside a polygon. For this, I researched on the Internet some solutions that can help me. I found one that seems to be of great help, but in one…
-
1
votes0
answers133
viewsHow to return the value within a function?
What’s the right way to make one return in a Function response, I have the following code: $('random-button').click(function(){ console.log(moveFile()); }); function moveFile(fileID, newFolderID,…
-
1
votes1
answer647
viewsHow to manipulate a vector of structs in an external function? Follow example
I am doubtful on a question. Follow the statement: Implement a library control system with functions to register, query, change and remove books. The attributes of a book are: Name (Book title with…
-
1
votes3
answers5196
viewsHow to set up a timer in Android Studio to perform tasks at constant intervals?
I am developing a simple application with Android Studio and need to create a timer to run some methods every 1 second. I tried it this way but it didn’t work: int delay = 1000; int interval = 1000;…
-
1
votes1
answer55
viewsFunction per parameter does not modify variables
I built a binary tree class in which I have a function bfs that goes all the way through it. As a parameter this method receives a function pointer void (*Op) (node_BT <type> *) that will be…
-
1
votes2
answers3207
viewsReplace specific column values with NA
I would like to detect and replace values above 6 in just a few columns of a data.frame by NA. I made the syntax like this, but it is giving error... Could someone give me a hand? Thank you! data…
-
1
votes1
answer252
viewsDoubt about Python classes and methods
I have a question, I can’t do an exercise in classes and methods. 2 - Create the class "Date" with the attributes: day, month, and year. And create the methods "setarData(receives day, month and…
-
1
votes1
answer69
viewsDoubt with C function
How do I get the variable I used to store value I read in the scanf, passed to the function I created? Ex: #include <stdio.h> int main(){ int a, b; scanf("%d %d", &a, &b); } int…
-
1
votes2
answers1727
viewsOracle-Variable without data
I have a problem and a doubt at the same time, I made a function to see invoiced orders and declared a function variable so: select filsaida into v_loja from mov_itped where pedido= p_pedido and…
-
1
votes1
answer66
viewsProblem with argument substitution in function
I’m having a problem with the arguments I pass in the function below, I’m trying to pass the argument sha512 for hash_type, so that the code within the function is replaced, and so hash_target would…
-
1
votes1
answer78
viewsDoubt in C++ program entry command
I am learning functions now in c++ and I went to try to run this program. It turns out that when I run it just doesn’t let me type in the value of cin>>p; it simply ignores the command and…
-
1
votes0
answers56
viewsI can’t understand why this error is returning
Error in round(Transform(x), digits) : non-numeric argument to Mathematical Function My code: leaflet(br_munic) %>% addProviderTiles(providers$OpenStreetMap) %>% addPolygons( fill = T, stroke…
-
1
votes1
answer39
viewsSyntax error: Variable problem inside the IF
My code: DELIMITER // CREATE FUNCTION f_desc (in_preco int) RETURNS INT BEGIN DECLARE fim_preco INT; IF in_preco >= 100 THEN -- aqui fim_preco := format(10 * in_preco/100, 2); ELSEIF in_preco…
-
1
votes1
answer138
viewsDoubts about functions
This my code simulates banking operations using functions, but I am not able to return the function values, when I Seto the value of the Return in a variable it calls the whole function. In the…
-
1
votes0
answers71
viewsDoubt in the printing of results
The exercise asks me to print, in a file, all possible paths between n cities, where the end is always the starting point and each city is represented as coordinates (x,y). That first part I managed…
-
1
votes0
answers937
viewsSuccess : Function ajax call another javascript function
function paginacao_tabela_clientes_status(idpessoa){ $.ajax ({ type: 'POST', dataType: 'json', url: BASE_URL + '/clients/tabela_clientes_pedido_entregue', data: {idpessoa: idpessoa}, success:…
-
1
votes2
answers168
viewsList entry with sequential search
I am trying to create a variable input function in a list that only allows entering terms not already contained in the list. I’m having trouble finding a logical solution to this, I can’t use break…
-
1
votes2
answers841
viewsProblem with recursiveness and pointers
I am struggling to resolve the following issue: Make a recursive function that allows you to sum the even elements of an integer vector, you must use pointers to traverse the vector My code is not…
-
1
votes1
answer54
viewsrecursive function error in c++
This recursive function should calculate the multiplication of two integers but it is always returning +1 in the result, someone can help me? int multiplic(int m1, int m2){ if(m2==0){ return 1; }…
-
1
votes1
answer1266
viewsHow to add elements to the tuple using a function?
def funcao(): int(input('insira um número:')) tupla = (funcao(), funcao(), funcao(), funcao()) print(tupla.count(9)) print(tupla) insira…
-
1
votes1
answer83
viewsPartitioning the algorithm into functions
The problem is this: a function takes an int as parameter, and returns it written backwards and another to test whether the input number and the inverted number is palindromic or not. I was able to…
-
1
votes1
answer767
viewsSending attachment php mail function
Good afternoon guys, I always use Phpmailer for sending emails, but I don’t know why this time I couldn’t configure on the server. So I’m using the code below to send and the question is that if you…
-
1
votes2
answers306
viewsGo function with parameters
I came across the following function in a framework of Map Reduce, but I didn’t understand her syntax. func (fc *FlowContext) newNextDataset(shardSize int, dType reflect.Type) (ret *Dataset) { ret =…
-
1
votes0
answers60
viewsError in output file
In an exercise, I need to read an input file as follows: # add # Jabuticaba # Fruto de jabuticabeira. Jabuticabeira. # add # Vacilar # Não estar firme. Cambalear. Oscilar. Tremer. # add # Jacapa #…
-
1
votes1
answer100
viewsHow to pass structure to function?
An agency in a small town has a maximum of 10,000 clients. Develop an algorithm that can enter each client’s account number, name and balance. The algorithm must print all accounts, their balances…
-
1
votes2
answers350
viewsFonts for standard Python functions
Is there any way I can figure out the algorithm behind functions like split() and in in Python, because in my faculty there are some forbidden functions.
-
1
votes1
answer615
viewsUse AJAX return in other functions
I have 2 functions: A function 1 returns a JSON via AJAX and lists the data in an HTML table dynamically, until then everything works. The function 2 need to manipulate the same data, however, I did…
-
1
votes1
answer812
viewsPass value for input inside table
The problem is this: I have a input product search, I type it filters and add in the table "items"; in the table "items" have input that filters services with value, and then I give split() take the…
-
1
votes1
answer785
viewsRemove duplicate elements from a python chained list
My code returns error when trying to run: class No: def __init__(self,inidado): self.dado = inidado self.proximo = None def pegaDado(self): return self.dado def pegaProximo(self): return…
-
1
votes1
answer60
viewsCode pattern for function calling
I don’t quite remember where, but I think it was in some discussion on a topic here in the same OS, referring to that in the statement of if, or any other function of the language itself must be…
-
1
votes1
answer185
viewsCode review: field validations, how to abstract correctly?
In a Java Swing application I have four JTextFields: Weather minimum of handover of an order in minutes Weather maximum of handover of an order in minutes Weather minimum of withdrawal of an order…
-
1
votes1
answer101
viewsError in function - Empty return
This function returns empty.. What’s the bug? Thanks! $id_pessoa = 1; function nome_pessoa() { $sql = mysqli_query($link, "SELECT * FROM equipe WHERE id='$id_pessoa' "); while($row =…
-
1
votes1
answer92
viewsList as function input
In Python 3.7 items of a list can be arguments of a function? def media(x,y,z): lista = [7,8,9]
-
1
votes0
answers26
viewsDoubt About Variable and Function
I am starting in Python, with the following characteristics: -User enters temperature limit -I read the user temperature compared to the sensor temperature -If Sensor Temperature is > User…
-
1
votes1
answer205
viewsColumn Python function for a list
I need to create a function that adds columns from one list to another list in the same order by following this structure here (you can use FOR). def column_to_list(data, index): column_list = [] #…