A function declaration is the process of describing only the return type, argument types, and name of a function. This is required in some programming languages to use functions that were defined at a later point in the code or in another file. Use this tag for questions that pertain to or problems caused by forward declaring functions in languages that support or require doing so.
Questions tagged [function-declaration]
549 questions
0
votes
4 answers
Why am I recieving a type error?
In Haskell, I am having some problems defining functions because the types of my argument does not match the required type.
For example, I would like to write a function that takes an n :: Int and produces the list of integers from 1 to the floor of…

user898033
- 519
- 1
- 4
- 5
0
votes
2 answers
Determine if JavaScript code is an expression
I'm using the following function named isExpression to determine whether some JavaScript code is an expression:
function isExpression(code) {
try {
new Function("return " + code);
return true;
} catch (e) {
return…

Aadit M Shah
- 72,912
- 30
- 168
- 299
0
votes
1 answer
How to access C function from another C function in iOS
I'm trying to assign a function to the AURenderCallback inputProc
int setupRemoteIO(audio unit etc){
inProc.inputProc = playerCallback
}
but it says that playerCallback is not declared in this scope although playerCallback is present in…

Namratha
- 16,630
- 27
- 90
- 125
-1
votes
2 answers
in C addresses do not work in functions , why is that?
When trying to use a C++ style in C:
void square(int &x){
x = x * x;
};
This gets an error.
error: expected ';', ',' or ')' before '&' token
i'm most comfortable with c++, but i'm learning C, is there a way to to have adressess in void…

Tonestones
- 11
- 2
-1
votes
1 answer
Trying to pass 2d array to function in C
#include
void triU(double **U, double *b, int n)
{
n--;
b[n] /= U[n][n];
for(int i = n - 1; i >= 0; i--)
{
double aux_sum = 0;
for(int j = i + 1; j <= n; j++)
aux_sum += (U[i][j] * b[j]);
…
-1
votes
1 answer
Dynamic allocation example in C
What is going on with adress and pointer types.
Can we dealocate the momory in the main function.
int *read(int *n) {
int i, *niz;
do {
printf("n=");
scanf("%d", n);
} while (*n < 1);
niz = (int *)malloc(*n * sizeof(int));
…

Sevo
- 27
- 2
-1
votes
4 answers
Returning a function object from a function C++
let the following function:
returntype Foo(void(*bar)(const C&));
what should be inserted instead of 'returntype' in order for Foo returning the passed
function\functor aka 'bar'

gaviezri
- 49
- 3
-1
votes
3 answers
In C, what does double asterisk ** in parameters of a function do
I came across a code snippet in linked list but this is the first time I see "**" double asterisk used in parameters. What does it do?
// Adding an item to the beginning of the list
void push(node_t ** head, int val) {
node_t * new_node;
…

gigaSecure
- 47
- 8
-1
votes
1 answer
How to use a char from a string in main for another function?
I want to pass two variables into a function in C - one being a string and the other being an individual character from a string.
However, I am not really sure how to use the function without either getting the "Expected Expression" error:
int…
-1
votes
2 answers
Implementing operator<< in C++ template class
I am having a compiler error implementing operator<< on a C++ template class. Here is the code:
#pragma once
#include
using namespace std;
//a template class to process a pair of "things"
template
class Pair
{
private:
T…

Pamela Price
- 41
- 8
-1
votes
3 answers
What is wrong in passing pointer variable as an function argument instead of address of variable in C?
I know that if I pass &a as an argument in fun ,I will get result as *p =20 after fun is executed .Now see in the following code p is pointer variable passed as an argument to function fun. But after compilation I get result as *p =10 instead of 20…

AMITk
- 15
- 3
-1
votes
2 answers
no matching function for call to Class::Method
When trying to implement a Priority Search Tree, i get this error when trying to build the tree
error: no matching function for call to 'ArbolP::crearArbol(ArrRazon*&, int, int&)
note: candidate: 'void ArbolP::crearArbol(ArbolP::ArrRazon*, int,…

Maleante
- 1
-1
votes
1 answer
CS50 clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
I'm taking the course Harvard CS50x and this is the caesar problem set.
#include
#include
#include
#include
int main(int argc, string argv[])
{
if (argc != 2)
{
printf("Nope\n");
…

Vish G
- 25
- 1
- 6
-1
votes
4 answers
Segmentation Fault using a function pointer with array argument
today i started learning C, and i got stucked in function pointers. This is my code:
main.c:
#include
int sumOfElements(int *arr, int arr_elements);
int main()
{
int (*ptr)(int,int) = NULL;
ptr = sumOfElements;
int a[] =…

Speed
- 5
- 2
-1
votes
1 answer
error declaring function C++ - Expected ';' at end of declaration list & Expected ')'
I am attempting to define a function and running into several errors.
I am able to define one function successfully like this:
void simulatedFixture(int fixAddress);
however when I attempt to define the next function like this:
void addFixture(bool…

test_subject_8055
- 65
- 1
- 5