Most voted "passing-by-value" questions
Passing by value is the act of passing the value of a variable as a function parameter. Therefore, the changes made in the parameter did not affect the variable, other than passing by reference.
Learn more…7 questions
Sort by count of
-
39
votes3
answers23304
viewsWhat is the difference between "passing by value" and "passing by reference"?
I know that in the first the object passed as an argument to a function is copied, and in the second not. I also know that it is extremely unusual in modern languages to pass complex objects by…
-
3
votes1
answer4789
viewsPass vector by reference or value?
I want to create two functions, one is to fill a vector with random numbers. The other function is to show the contents of the filled vector. So I did it this way: #include <stdio.h> #include…
-
1
votes2
answers1215
viewsHow to pass arguments by value in Python?
def somentenumeros(entrada): try: int(entrada) return True except: return False while True: cpf = input('Digite seu CPF ou digite os nove primeiros digitos ') if somentenumeros(cpf) == False or…
-
1
votes1
answer113
viewsSyntax errors in C
I’m doing this exercise in C, but I’ve locked into this part of passing parameters with pointer. Basically the program below sums up the share of real numbers and integers. The problem is that the…
-
1
votes1
answer906
viewsPassing variable value obtained in one method to another method in Java
The project is a school GED, where there is the main class that makes the connection to database and there is another class to generate PDF files. The issue is that the system comes to extract the…
-
0
votes2
answers215
viewsWhy can’t I pass a matrix as a parameter of a function in C?
Dear friends, today I have come across a problem I cannot understand. When trying to pass an array as a parameter, I cannot access the values of the elements, I always access the memory addresses of…
-
0
votes0
answers59
viewsHow do I pass the values stored in a truck so another function can modify it?
I’ve been trying to make this project run since yesterday, but I can’t manipulate the data of my struct when I move it to another function, the other function simply create other values, the goal of…