Questions tagged [function-calls]

Function (or method) calling is the act of using a function or a method.

Functions (or methods) are blocks of code.
They are there, ready to perform some action (a sequence of instructions, including the possibility of calling other functions - even themselves, which is called recursion).
If nobody calls them, the are useless (dead code).

351 questions
0
votes
1 answer

c++ beginner: function call on object not executing properly

I cannot figure out why the code isn't executing properly. When i use the function 'adder' inside of the class it does not return the sum which it would have if it were simply run in main as adder(3,1) and defined outside of the class. class…
Rachel
  • 1
  • 2
0
votes
1 answer

How does return function return a value to If statement?

How is value 1 passed to the if statement in main function and how does the return function work with a recursive call in it? #include #include int identicalTrees(struct node* a, struct node* b) { if (a==NULL && b==NULL) …
user3815757
  • 161
  • 1
  • 1
  • 10
0
votes
3 answers

Function Call not working properly

here is my function call, it has a prototype and everything compiles fine, except I am not getting the result I want. string lower_case(string x) { transform(x.begin(), x.end(), x.begin(), ::tolower); return x; } Now this simple function…
Uys of Spades
  • 173
  • 1
  • 9
0
votes
4 answers

Calling the function twice vs. storing the output and using it in Java

Suppose that I have a boolean function isCorrect(Set). The parameter of the function is calculated by another function buildSet(). Which one is better in terms of both time and space efficiency? Set set =…
padawan
  • 1,295
  • 1
  • 17
  • 45
0
votes
1 answer

Polymorphism Trouble in C++

I'm trying to access a data member of a derived class through its base class and I'm having some trouble. Here is the code: for (auto actor : drawables) { if (actor.isDrawable()) { std::vector verts = actor.getVerticies(); …
leaflet757
  • 159
  • 1
  • 1
  • 9
0
votes
1 answer

How to make program determine largest user input

So my task is to write a program that determines which of a company's four divisions had the greatest sales for a quarter. I am basically having an issue with the my cout statement not spitting out the location. Here is what I have: function…
Tyler Kelly
  • 564
  • 5
  • 23
0
votes
1 answer

How to call a File pointer in a function

I need to scan a file for letters to form a scrambled word. Everything looks okay but the debugger doesnt execute the command. Any advice would be greatly appreciated. Code: void playGame(char array1[SIZE], FILE*aPtr) { aPtr =…
user3303682
  • 3
  • 1
  • 2
0
votes
1 answer

Bad memory access while copying string without space

This is the structure that i have typedef struct { int startIndex; int length; char *rawString; }Tokenizer; I got a function to copy string (Which will trim out the space) void copyStringWithoutSpace(char *source,char *destination ) { …
Jing Wen
  • 20
  • 4
0
votes
2 answers

optional arguments when calling a function without modifying function definition

I want to know how to call a function, passing a parameter that it might not be expecting. I faced this problem a few days ago, and found a way around it. But today, I decided I'd see if what I wanted to do was possible. Unfortunately, I don't…
Ponkadoodle
  • 5,777
  • 5
  • 38
  • 62
0
votes
0 answers

How to bind a function to every other function call?

Today I painstakingly merged several thousand lines of code from three different files into a single .js file. The files all had the same origin but evolved in different projects with some slight (but crucial) differences. I managed to merge the…
Jonathan
  • 8,771
  • 4
  • 41
  • 78
0
votes
2 answers

Call-By-Value vs Call-By-Reference revisited

let me first say. I know the title suspects that I'm asking a question which was answered here and around the internet many times. I did research indeed yet I just can't find a satisfying answer. My question in the end comes down to this. Why is…
ben
  • 5,671
  • 4
  • 27
  • 55
0
votes
1 answer

Why only the return value of the second function call is printed?

When I write this code in the console: function lol() { var a = 6; return a; } function test() { var a = 8; return a; } lol(); test(); It prints only the return value of the second function call like this: 8 Why this is…
0
votes
1 answer

Calling Funcs with Pointer Params vs Reference Params

I was hoping someone could explain to me why a function with a reference parameter would be called rather than one with a pointer parameter, given something like the following: int Func1 ( int & a ); int Func1 ( int * a ); int main() { int y =…
Victor Brunell
  • 5,668
  • 10
  • 30
  • 46
0
votes
3 answers

Mutually Dependent Function Declarations in Functions

Is it possible to have two or more outer function-scoped functions that have mutual call dependencies on each other? I'm asking because void main(string args[]) { int x = 42; void a() { // do something with x b(); } …
Nordlöw
  • 11,838
  • 10
  • 52
  • 99
0
votes
0 answers

A qu. of style: dynamic map JSTL hack to work around missing parameter function calls

This is not a problem that needs a solution but a question to the experienced developer (hope such things are allowed here too..) about how they judge this proposal. In JSP/JSTL you can only "call" pure getters (without parameters), i.e.…
hyphan
  • 179
  • 1
  • 5