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
-3
votes
1 answer
What does 'const' signify in function declaration 'int const& foo()'?
What does const signify in a function declaration like int const& foo()? Does it mean the function will not modify any variables, or that it returns the address of a variable which is constant?

blarredflunky
- 43
- 1
- 4
-3
votes
4 answers
Pointer to void as an argument in a function with no prototype for variable number of arguments
Say I have a function that should accept any number of parameters, so what im coing here is declaring no prototype, and letting the function to be created when it is called in the code. I am using a pointer to void to receive the random number of…

RobertoNovelo
- 3,347
- 3
- 21
- 32
-4
votes
1 answer
putting return type in front of swap function call makes it not work(c programming)
Hello so I am learning pointers in c programming right now and I made a basic call by reference swap function that doesn't work as seen below.
#include
void swap (int *x, int *y) {
int temp = *x;
*x = *y;
*y = temp;
}
int…

Gabriel H.
- 1
- 1
-4
votes
1 answer
C++ compiler option to allow the use of incomplete type in classes that make use of each other?
Is there a compiler option that will allow the following code to compile, without moving the function definition to the bottom?
class first{
int a;
void func(second b){}
};
class second{
int a;
void func(first b){}
};

Humid Morning
- 5
- 3
-4
votes
1 answer
it always show build fail when i declare the class
Here's the abstract class
class number_sort{
public:
int num[1024];
int qww(int a);
public:
bool status;
int number=0;
virtual bool compare(int a, int b);
virtual void sort();
virtual…

Richard w
- 16
-4
votes
6 answers
Are there specific rules for defining a function in C?
I am writing a script that can process .c and .h files. Using regular expressions I am finding all functions within a given file. During my experiences with C I always defined functions in the following manner:
void foo(int a){
//random code
}
Is…

Walter Kovacs
- 57
- 2
- 3
-5
votes
4 answers
How is a string declared as a parameter to a function in c?
I wanted to know in what ways a string can be passed to a function and what is the corresponding syntax of the function declaration.

User 1426833
- 81
- 6
-5
votes
1 answer
Why would JS allow this function to be declared?
I have a question about decalaration of JS function.
I declared a function as follows:
create=(name,agfdf,gender)=>({name,a,gender});
(name,agfdf,gender)=>({name,a,gender})
the argument passed is agfdf, but the output does not contain agfdf. The…

ZZZ
- 1
- 1
-5
votes
1 answer
How to pass a void function(void) in to another function as parameter in c
[enter image description here][1]I have a function void readline() which output a string, and I want to pass it into another function as a parameter, how can I do that,
Thanks for any help.
int scorecount(argc1, argv1, void readline());
void…

Hu Yunfei
- 11
- 3