Declaration is the part of the subprogram (procedure or function) which provides the protocol(header), but not the body of the subprogram.
Questions tagged [declaration]
3407 questions
1
vote
0 answers
How to understand C language redefinition and redeclaration error?
I'm not really sure am I right, but i think that: in the line static int k; variable is declared and defined (k is initialized by default to 0); in the next line static int k = 31; I initialized k to 31 (why this is not redefinition?); in the next…

Alex Blaung
- 51
- 5
1
vote
1 answer
How can I add XML declaration when I create a new file?
I'm creating an XML file, when a determinate event occurred.
I've already try what some people answer in another similar questions, however it seems it doesn't work, because it still be missing the declaration.
This XML file contain the following…

Esmeralda G.
- 27
- 5
1
vote
4 answers
Where to declare structures
I've made 3 files to organize my code. A main.c, a functions.h and a functions.c. I've also made a structure to use with some functions, and I'm having the problem that I can't find any way to declare the functions that use the structures in the .h…

Gabriel Machado
- 401
- 3
- 14
1
vote
0 answers
How to write type-declarations for namespace-structured modules
So I'm trying to refactor the type-declaration of a module called inquirer which is strictly namespace-structured.
I really don't like having one single file with 1k lines of code inside of it, so I tried to split the whole type-declaration up into…

manuth
- 51
- 5
1
vote
1 answer
"expected expression before char" inside function
I made a function which creates a game board and want to call it on my main. Also, the variable that it uses is a global variable defined outside the main (char board[3][3])
I tried defining char board[3][3] inside main as well but the error keeps…

Valeria
- 13
- 4
1
vote
0 answers
Why does gcc produce an error for implicit declaration of functions returning not int?
There are a few similar questions asking people to debug their code, where the compiler produces a warning of implicit declaration of functions. I know that this warning is produced because if a function is used without there being a prior…

Galaxy
- 2,363
- 2
- 25
- 59
1
vote
1 answer
Using variable outside of try catch block (Java)
I have a variable that I have delared before a try catch block to make sure I can access it outside of the block
/*
Try to get a list of all files.
*/
List result;
try( Stream walk =…

bell_pepper
- 187
- 11
1
vote
1 answer
Declaration syntax error in GTuner IV function after compiling
I'm using the GTuner language and the GTuner IV 1.1 compiler. My code seems to keep outputting the warning after compiling
GPC error: PressXInput.gpc(18): Declaration syntax error 'combo'
Using GTuner to compile this (Titan Two)
Any help to fix…

Run911
- 11
- 1
1
vote
1 answer
Compile Error with using lamda function with max_element
I am trying to write some code to find the contour with the maximum size in a std::vector of contour.
I have the following error
error: conversion from ‘__gnu_cxx::__normal_iterator >*,…

user1538798
- 1,075
- 3
- 17
- 42
1
vote
3 answers
Function declaration before and after main()
#include
int add2nums( int, int);
void main(void)
{
int y,a,b;
printf("Enter 2 numbers\n");
scanf("%d%d", &a, &b);
y = add2nums(a,b);
printf("a is %d\n", a);
printf("b is %d\n", b);
printf("y is %d\n", y);
}
int…

Aragorn90th
- 13
- 3
1
vote
2 answers
How to declare and initialize an array of pointers to array of pointers to char?
I want to declare an array of pointers to array of pointers to char and initialize it. But i couldn't declare and initialize it using the following way:
char *(*array[])[] = {
{ "car", "toy", "game" },
{ "go", "play", "read" }
};
Please write…

Alex Mercer
- 83
- 8
1
vote
2 answers
Cleaner way of declaring many classes in perl
I´m working in a code which follows some steps, and each of this steps is done in one class. Right now my code looks like this:
use step_1_class;
use step_2_class;
use step_3_class;
use step_4_class;
use step_5_class;
use step_6_class;
use…

nck
- 1,673
- 16
- 40
1
vote
0 answers
Why can we use an object during its declaration?
I stumbled upon a line of code in this question. It can be boiled down to
#include
struct foo {
int x;
foo(int a) : x(a) {}
};
int main() {
foo f(f.x); // UB !!
std::cout << f.x;
}
It compiles with a…

463035818_is_not_an_ai
- 109,796
- 11
- 89
- 185
1
vote
2 answers
Do instance variables declared outside of `__init__()` have any differences in python?
I'm wondering weather it is necessary to define class instance variable within class declarations.
I tried assigning a new instance variable after the object (class instance) was already created, and looks like there is no difference. Are there any…

DsL
- 13
- 2
1
vote
1 answer
enums declaration in class C++, problem getting to enum in class
I have problem with the declaration of enum in my class.
I had tried to declare it on private, public, outside, in the main, nothing works.
I need to call function in the class from outside and use the enums in the function
here is my code.
class…

user692601
- 107
- 1
- 3
- 12