Questions tagged [function-call]

A function call is a line of code that executes a specific block of code defined as a function, that is, self-contained code that may optionally take arguments, defined for the purpose of code reuse.

A function call is a line of code that executes a specific block of code defined as a function, that is, self-contained code that may optionally take arguments, defined for the purpose of code reuse.

760 questions
2
votes
1 answer

Incompatible pointer types warning when printing function pointers

I am trying to create an array of function pointers, so that I can print out output from the functions by using the pointers. (For an exercise from the Effective C book.) #include #include int a(void) { return 1; } int b(void)…
2
votes
2 answers

Double derived class produces error unless call to Base

The following code causes my compiler to produce two errors: type name is not allowed and expected an expression. #include class Base { protected: template void print_pi() { std::cout << (T1)3.141596 <<…
Hufh294
  • 89
  • 5
2
votes
1 answer

C incomplete types: linker doesn't warn about obvious error

A file main.c declares a function of the incomplete type int func(), then uses it as int func(void). The function is defined in a second file as int func(int, int, int), which is consistent with the declaration, but not with the usage. I would…
2
votes
1 answer

Same code works in main, but not when calling from a function in C

Okay so I'm a beginner programmer so any tips on any part of the code are greatly appreciated, but the main question is why does the code in function int longestSequence(int n,int array[n]);work when placed in main, but not when called from the…
Mary
  • 23
  • 3
2
votes
2 answers

What does it mean to say "Function Calls are Resolved at Compile Time"

I am trying to understand the meaning of the saying "Function calls are resolved at compiled time". I know about the concept of polymorphism and there i know that virtual functions are called(or resolve or whichever is the correct phrase i don't…
user16783784
2
votes
3 answers

Does Haskell have implicit pattern matching?

Take this example: module Main where main = print (reverseWords "lol") reverseWords :: String -> [String] reverseWords = words reverseWords function is not pattern matching against any argument here yet the function runs and outputs…
Andrew Tang
  • 157
  • 1
  • 3
2
votes
1 answer

passing argument 1 of 'a function' makes pointer from integer without a cast

Probably a really easy question, but I'm trying to make a tic-tac-toe engine and this is the code (putting it later because despite me closing the triple graves it still puts it in code block if below for some reason) I get warnings for: [Warning]…
2
votes
1 answer

How the values of array got affected in the following c++ code?

When the following program is compiled, the output is if break float while break. #include using namespace std; string s[5]={"if","int","float","while","break"}; string & blast(int i){ return s[i];} int main() { for (int i = 0; i < 5;…
Mathaddict
  • 135
  • 6
2
votes
2 answers

What is meant by this error? Argument of type "void" is incompatible with parameter of type "void (*)(int a)"

I am trying to use a function pointer to call another function, but it gives me an error. I don't understand the error. Here's my code: #include #include void print(void (*ptr)(int)); void printint(int); int main() { char…
2
votes
2 answers

How to use a PHP associative array as function call arguments?

Assume that there is a function with some parameters and I have an associative array (or a simple object with public properties - which is almost the same, since I can always use a type cast (object)$array) whose keys correspond to the function…
whyer
  • 783
  • 5
  • 16
2
votes
2 answers

C Pointers, understanding how to pass arrays to function

I'm currently revising on C pointers for an upcoming test and I came across a rather interesting program as I was running through the lecture slides. #include #include void convertToUppercase(char *sPtr);//function prototype,…
2
votes
1 answer

Are function calls with arguments valid left-Hand-Side-Expressions according to ECMAScript

Are function calls with arguments valid left-Hand-Side-Expressions according to ECMAScript ? LeftHandSideExpression[Yield, Await] : NewExpression[?Yield, ?Await] CallExpression[?Yield, ?Await] OptionalExpression[?Yield, ?Await] if…
Kevin
  • 209
  • 2
  • 11
2
votes
1 answer

Why might a function not get called in initState(){ super.initState()} in flutter, but work perfectly fine if called later in the same page?

I have a function named splitVendorMainCategory, which simply splits a List into two subLists, described as: List vendorMainCategory = ['one', 'two', 'three', 'four']; Future splitVendorMainCategory() async { for (int i=0; i<…
2
votes
3 answers

Console error: [function] is not defined, although it is

I'm calling my function in my HTML, and even though the function originates in the same file I'm receiving an error stating that the function is undefined. I cleared the browser cache, but with no luck. I tried calling the function in a click event…
Bodrov
  • 840
  • 1
  • 15
  • 29
2
votes
1 answer

What is a runtime-constraint?

I've heard of the term "runtime-constraint" many times. I have been looking for the term "runtime-constraint" in the actual standard ISO/IEC 9899:2018 (C18), but all that I have found is: Source: ISO/IEC 9899:2018 (C18), Section 3.18: 3.18 1…