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
2 answers
Avoiding multiple near identical declarations for classes that implement a interface
I have a abstract base class called Command that acts as an interface for commands that can be put in a queue:
class Command
{
public:
Command(Dependency1& d1, Dependency2& d2);
//...Irrelevant code removed for simplicity...
private:
…

Unimportant
- 2,076
- 14
- 19
1
vote
1 answer
creating variables with increasing integers
I want to create a pyomo model with 1000 basic pyomo variables.
I know it is a bad idea to do this like the following script.
And it is also not working. I hope you understand the idea and be able to help me.
import pyomo.core as pyomo
def…

oakca
- 1,408
- 1
- 18
- 40
1
vote
2 answers
Avoiding repetition in declarations that have inner different characters
Is there any way to avoid repetition where you are declaring multiple instances of the same type that have something in between that varies? declaring the fixed statements only once, then declaring the inner variables inside them multiple times…

Sorena
- 41
- 5
1
vote
1 answer
C array with "[ ]) (char **)"
I found the following declaration in the lsh source:
int (*builtin_func[]) (char **) = {
&lsh_cd,
&lsh_help,
&lsh_exit
};
I'm relatively new to C, but the (*builtin_func[]) (char **) looks very odd. What does it mean?
(I'm more interested in…

wispi
- 431
- 3
- 14
1
vote
1 answer
C++ Is a pure virtual function also a definition or only a declaration?
In a C++ programming course I have learned about the difference between definition and declaration. A function without a function body is a declaration and a function with a function body is a definition. Later I have learned about pure virtual…

stonar96
- 1,359
- 2
- 11
- 39
1
vote
1 answer
Why is a long written with an L
If I want to save a long variable, why do I have to write an L or l at the end of the value?
For example:
9_223_372
long v = 9_223_372L;
But if I save it:
long v = 9_223_372;
it's still a long variable. So why do I have to write L or l?

Lunar Cultist
- 71
- 5
1
vote
4 answers
How to declare a public variable variable in a class
Hey I have a class like this
class derp{
public $$ini;
public static function regIni($ini){
derp::$$ini = 'test';
}
}
And then in another file I have
core::regIni('register');
And then somewhere else I use
core::$register;
This produces an…

Robin
- 13
- 1
- 4
1
vote
2 answers
C array declaration syntax
Declare an array in your include file omitting the first dimension size:
extern float mvp[][4];
Then define the array following the previous declaration in a translation unit:
float mvp[4][4];
No problem. Until you try to get the size of that…

explogx
- 1,159
- 13
- 28
1
vote
1 answer
Empty value for Date type in Swift
I'm very new to swift.
How to set empty value for Date type in Swift to be used in declarations?
Like:
var string: String = "" for String type
var integer: Int = 0 for Int type.
Thank you.

halim
- 87
- 2
- 2
- 11
1
vote
0 answers
How to dynamically declare an instance variable?
I have the following class:
public class MotherFactory {
private String food = "banana";
private static FoodFactory foodFactory = new BananaFactory();
public MotherFactory() {
}
}
In this class i declare a…

NicO
- 591
- 2
- 8
- 21
1
vote
2 answers
Declaring variables outside loop/IF structures in C
I'm new to the C language, rather programming overall. I was wondering why is it that when I declare a variable to be used within an if statement OUTSIDE the structure, that the output I've received is incorrect (for this piece of code…

mhwk1999
- 7
- 4
1
vote
1 answer
VB declaration of table
I have a little problem: I want to make some app in VB and I make two CheckedListBoxs and I have some idea: if I chose something in CheckedListBox1 I want to show some date inside CheckedListBox2.
I have a problem with declaration - I make something…

gajus21
- 11
- 3
1
vote
1 answer
Strange definition method (def) in Groovy. Looks like an object or function with no name
I came across this in code a few times, and cannot figure out what this declaration is exactly. It appears to simply be a collection of variables, but is being passed together as though it is some singular variable or object itself holding all 3…

William Tolliver
- 305
- 1
- 2
- 16
1
vote
2 answers
JavaScript DOM - access a variable made with document.createElement after that element is created?
I created a div (variable "box") using document.createElement inside of a function. I then need to use that variable inside other functions. Is it possible to access this variable outside the function or assign it globaly after it has been…

CaptainSensible
- 25
- 6
1
vote
6 answers
Why doesn't Java allow omitting formal parameter names in a function declaration?
I'm looking to understand why Java designers chose to implement function declarations this way. I've often heard it said that the designers of Java wanted to avoid poor design choices made in other languages (e.g., C++) -- multiple inheritance via…

ars-longa-vita-brevis
- 735
- 1
- 8
- 18