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
votes2
answers778
viewsEmpty if declaration in function
It is possible to create a function that ends with an empty if statement and allows the code that called that function to determine if action? Example: def if(): if x>6: x = input("Valor de x")…
-
2
votes1
answer129
viewsHow to reuse a function correctly in C?
I have the following functions : int divisibilidade3(int num); int divisibilidade9(int num); int testarDivisibilidade(int dividendo, int divisor); With the function testarDivisibilidade I’ll test…
-
2
votes1
answer108
viewsC program to concatenate strings does not execute correctly
include int main(){ void concatenarStrings(char string1[], int t1, char string2[], int t2, char string3[]); char palavra1[]={'p','a','o','c','o','m'}; char…
-
2
votes1
answer223
viewsIs there an R function that helps me locate the fashions of a multimodal dataset?
Something like Encontramoda(Dataset, N_maiores_modas)? I am working with the following integers: c(1,2,3,4,5,6,7,7,7,8,8,8,9,9,9,9) That is, the example is trimodal and has a bigger fashion than the…
-
2
votes1
answer83
viewsExcel DISTF equivalent in R
I wonder if there is in the software R a function similar to the function of the software Excel, DISTF? The excel DISTF function returns the probability distribution F (right-tail) (diversity level)…
-
2
votes1
answer56
viewsWhat do the characters mean in the parameter of a function in Elixir?
For example: defmodule Math do def add(a \\ 2, b) do a + b end end What those two bars mean?
-
2
votes3
answers94
viewsMake a function that shows whether the number is integer or not
I need to do a function that returns: is whole or not whole.
-
2
votes1
answer82
viewsHow to pass values via terminal to a program function
#include <stdio.h> #include <string.h> void soma(int a,int b); int main(int argc,char *argv[]) { printf("A soma="); return 0; } void soma(int a,int b){ printf("%d\n",a+b); } As step the…
-
2
votes1
answer2788
viewsHow to properly use memcpy?
I’m trying to create a program where it will have two vectors : char vetor_origem[20] = "algoritmo"; char vetor_copia[20] In what can be seen, in the vetor_origem I have the word algorithm written,…
-
2
votes1
answer181
views -
2
votes2
answers607
viewsIs it possible somehow to overload functions in C?
I’m already programming in C, in a procedural way, but a few months ago I started programming oriented to objects. In Java, it is possible to overload functions. Since Java is an object-oriented…
-
2
votes2
answers69
viewsHow to create function where I need to pass the parameter inside a text block in R
I need the cnpj variable that is estre the tags <Parameter> be called as a function parameter. But note that it is within a text block that I use to consume a web service. It is possible…
-
2
votes1
answer47
viewsThe use and non-use of the word Function in Typescript
Why when I declare method in a class the compiler beeps, stating that the word usage is wrong function. In previous lessons of my learning to create a function I signed first as function. abstract…
-
2
votes1
answer150
viewsfunction if - true copy cell and glue in another
I need a little help. I have an excel sheet and I want to do the following: In this capacity = SE(F10=O11;Copia valor celula G2 e cola na celula G10;"falso") I want to make a comparison and if true…
-
2
votes2
answers153
viewsNext 0-Z Sequence Code with Javascript
I need to create a Javascript function that takes a string of letters and numbers and it returns the next count value. The count goes from 0 to Z. Example of the sequence: 0 - 1 - 2 - 3 - 4 - 5 - 6…
-
2
votes1
answer92
viewsFunction with variable number of parameters via template
I know that templates in function definitions do, for each configuration it makes possible, compile a distinct function. I want to know if it is possible to create functions of varied number of…
-
2
votes1
answer35
viewsVector Search - Arrayindexoutofboundsexception
I’m building a function that does a linear search on an arrangement. What I would like is that instead of leaving in the call the value of the size of the arrangement, I would like to use the…
-
2
votes2
answers190
viewsHow to know the difference between language construction and function in PHP?
How to identify and what is the difference between a language construction and a function?
-
2
votes2
answers105
viewsError trying to imprint the return of a two-dimensional matrix
I’m trying to print a two-dimensional matrix through a loop for only that the matrix it is returned through a function that I created. I’m suspecting that the mistake must be found in it but I’m not…
-
2
votes3
answers8998
viewsHow to call, in Python, a function whose name is stored in a variable?
You have 99 different definitions of functions: def Fun_1(): ... def Fun_2(): ... def Fun_3(): ... ... ... def Fun_99(): ... the value of the variable x is obtained at random between 1 and 99: x =…
-
2
votes2
answers218
viewsSee how native functions were written - Python
There is a practical way to check, how is written the code of any Python function, example max()?
-
2
votes2
answers606
viewsEmpty function return
Could someone tell me why my insert2 function is returning null after insertion? she should be returning the string with the success message. <?php require_once 'conexao.php'; $con = new…
-
2
votes1
answer499
viewsHow do I resolve struct statement Warning?
I’ll send the code and the warnings that GCC is reporting. I must ignore warnings? The warnings are related as the passage of struct for the job Inserir();: #include <stdio.h> #include…
-
2
votes1
answer157
viewsMeasure time of a routine in Ruby
Is there a Ruby function to measure the time of a function? In python I use: ini = time.time() #função fim = time.time()
-
2
votes2
answers90
viewsWhy can normal functions not have "auto" arguments if "lambda Expressions" can in C++?
I realized that the "lambda Expressions" accept arguments of the type auto. For example: auto add = [](const auto& x, const auto& y) { return x + y; } So I tried normal functions, but it…
-
2
votes2
answers105
viewsHow do I use dynamic information coming by ng-repeat {{}} and use it as the argument of an ng-click (button) function?
I have a function ng-click: ng-click = "adicionar(0);" This function ng-click is inside the loop ng-repeat = "mercadoria in listademercadoria". There is a way to pass on information according to the…
-
2
votes1
answer3275
viewsCheck if the input is an integer
I need a function that reads a keyboard input and validates whether it is an integer (negative or positive). If it is, it should return the value. Otherwise, it should report that the entry is…
-
2
votes0
answers5015
viewsUndefined Reference to
I have a program that’s divided into your main, city.c and city.h. Main: #include "city.h" int main() { FILE *entrada; FILE *saida; Cidade *cidades; entrada = fopen("entrada.c", "r"); int…
-
2
votes1
answer212
viewsHow to ignore an error in R?
I created a function inside, however, if at some point an error occurs, it is not important to me and I want it to continue until the end, ignoring the error. valor<-1 Erro<-function(valor){…
-
2
votes1
answer404
viewsHow do you return multiple objects in a function of r?
The basic structure of a function in R is: function( arglist ) expr return(value) My question is how to return multiple information. For example: funcao<-function(a,b,c){ if(c==1){d<-a+b}…
-
2
votes2
answers1233
viewsDate Working Hours - SQL Server
Guys, I have a question. In the query below, in the tarexpiration field, he is counting the hours normally, however, I want to count only the working hours. NOTE: Already has a useful hours function…
-
2
votes1
answer82
viewstoggle menu function does not work with data-Attributes
I am trying to make a function that causes the buttons to change only the data-Attributes of the menu with corresponding value, however, no error is shown on the console, but also does not work:…
-
2
votes1
answer70
viewsThe entry point of a executable is the memory address of the main function?
hello. c #include <stdio.h> void main(void){ // << entry point printf("Hello World!"); } hello asm global _main extern _printf section .text _main: ; << entry point push message…
-
2
votes1
answer7425
viewsFunction takes as parameter a string array
I just started learning the C programming language and I’m having a hard time. I declare a string vector, pass values to that vector and then pass that same vector as a function argument. The…
-
2
votes3
answers1165
viewsPass a variable from one function to another
Hi guys, okay? Next, how could I send the variablemts_quadrados of def prog( ) to be calculated in def prog_main( )? def prog(): print("Informe o valor: ") cli() mts_quadrados = int(input(":"))…
-
2
votes2
answers501
viewsHow to receive an input during an R function?
It is possible to ask a question and receive an input while executing a function? Example: formateCdoispontos<-function(){ print('Tem certeza que quer fazer isso? (S/N)') ...…
-
2
votes1
answer88
viewsJavascript function duplicating data when dynamically loaded
I have a function called calculator to which the page is dynamically loaded several times (whenever the user calls the calculator page). When you first load it is normal, but the more you load the…
-
2
votes2
answers174
viewsVector receiving a function that returns integers
Guys, I have some questions about vectors and functions. public class teste{ /*Função que retorna um vetor de inteiros com números aleatórios*/ public static int [] vetorFuncao(){ int…
-
2
votes1
answer48
viewsProblems with data registration with Combobox listing and function
I’m having great difficulties with the combobox and the use of Function in Delphi I apologize, I am beginner in the world of programming and can not identar the code here, I will leave the code in…
-
2
votes1
answer153
viewsHow to pass the return of a function that is a tuple as arguments to another one in Python?
I’m trying to return multiple values from one function to another with multiple parameters: def chamar_ab(): a = 1 b = 2 return a, b #tupla def soma(x, y): return x + y But using it doesn’t seem…
-
2
votes2
answers90
viewsUse Javascript function within a PHP table column
Hello, I am calling a JS file in my index.php: <script src="./Arquivos/js/ddtf.js"></script> And within an echo I need to apply the function that exists within it: <td><?php…
-
2
votes1
answer105
viewsHow to send a dynamically created matrix as a parameter to a function?
In the execution I am developing I try to pass a matrix created dynamically created with the function malloc, but in doing so the compiler points to type incompatible with pointer. #include…
-
2
votes2
answers54
viewsWhy does a Function invoked by onclick not influence external commands to it?
As can be seen in the code, the variables declared are global, and the routine should display the result on the console as soon as the "Send" button was selected. <!DOCTYPE html> <html>…
-
2
votes1
answer401
viewsIs it possible to access the address of a C function?
It is possible to access the address, literally, of some function and C and also store in some variable of the main(), etc..? int f1() { }; int main() { int *ponteiro; ponteiro = &f1;…
-
2
votes1
answer210
viewsMake a parameter change the value of the variable with pointer
It is possible to work with pointers in JS, if yes, how do I do this? In the example below the goal is to make the variable str stay with the value: "worked :D" var str = "teste"; function…
-
2
votes0
answers49
viewsProblems returning an Arduine array
I’m not getting back the array of the following code: void loop() { if(tem_msg){ lcd.clear(); // <-- limpa o cursor e retorna ele pra linha 1 e coluna 1 lcd.print(msg[indice]); // <-- printa a…
-
2
votes2
answers106
viewsHow to put the response of a function as a parameter in another function?
const soma = function (a,b) {return a+b} console.log(soma(2,4)) let nun1 = 3 const soma2 = function (soma, nun1) {return soma+nun1} I want to get the result of the sum function which is 6 and somar…
-
2
votes1
answer186
viewsDo irreversible operations exist?
In mathematics (therefore in programming) there are mathematical operations (+,-,*,/). But all the mathematical operations I know are perfectly reversible, for example, by dividing a number, I could…
-
2
votes2
answers65
viewsError calling Function on my page
I’m having trouble calling two functions to validate the fields txtnome and txtsobrenome, calling the roles validanome() and validasobrenome(). I tried to call them the following way: if…
-
2
votes2
answers35
viewsHow to find out which of the id’s triggered a javascript function
I am new in the area and would like to know how to identify which of the id’s that triggered the click function. Or if there is a better way to accomplish this code, the idea is to do a javascript…