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
173
votes
9 answers
What happens to a declared, uninitialized variable in C? Does it have a value?
If in C I write:
int num;
Before I assign anything to num, is the value of num indeterminate?

atp
- 30,132
- 47
- 125
- 187
162
votes
10 answers
More elegant way of declaring multiple variables at the same time
To declare multiple variables at the "same time" I would do:
a, b = True, False
But if I had to declare much more variables, it turns less and less elegant:
a, b, c, d, e, f, g, h, i, j = True, True, True, True, True, False, True ,True , True,…

Trufa
- 39,971
- 43
- 126
- 190
162
votes
11 answers
How to declare variable and use it in the same Oracle SQL script?
I want to write reusable code and need to declare some variables at the beginning and reuse them in the script, such as:
DEFINE stupidvar = 'stupidvarcontent';
SELECT stupiddata
FROM stupidtable
WHERE stupidcolumn = &stupidvar;
How can I declare a…

bl4ckb0l7
- 3,839
- 4
- 28
- 33
158
votes
4 answers
Is "long long" = "long long int" = "long int long" = "int long long"?
I found both long int long and int long long can compile for a variable type. Is there any difference between long int long, int long long , long long and long long int?
In general, is the type identical if it has the same number of long?
1…

ggrr
- 7,737
- 5
- 31
- 53
152
votes
7 answers
What's the _ underscore representative of in Swift References?
In the reference section of Apple's docs there's lots of instances of this sort of thing:
func runAction(_action: SKAction!)
The Objective-C 'equivalent' of this is:
- (void)runAction:(SKAction *)action
It strikes me that it's probably…

Confused
- 6,048
- 6
- 34
- 75
150
votes
3 answers
Difference between int32, int, int32_t, int8 and int8_t
I came across the data type int32_t in a C program recently. I know that it stores 32 bits, but don't int and int32 do the same?
Also, I want to use char in a program. Can I use int8_t instead? What is the difference?
To summarize: what is the…

linuxfreak
- 2,068
- 3
- 20
- 29
145
votes
8 answers
Variable declaration placement in C
I long thought that in C, all variables had to be declared at the beginning of the function. I know that in C99, the rules are the same as in C++, but what are the variable declaration placement rules for C89/ANSI C?
The following code compiles…

mcjabberz
- 9,788
- 10
- 36
- 38
141
votes
16 answers
Component is part of the declaration of 2 modules
I try to build an ionic 2 app.
When I try the app in the browser with ionic serve or launch it on an emulator everything works fine.
But when I try to build it every time the error
ionic-app-script tast: "build"
Error Type AddEvent in…

Stevetro
- 1,933
- 3
- 16
- 29
137
votes
9 answers
Declare variable in SQLite and use it
I want to declare a variable in SQLite and use it in insert operation.
Like in MS SQL:
declare @name as varchar(10)
set name = 'name'
select * from table where name = @name
For example, I will need to get last_insert_row and use it in insert.
I…

Muhammad Nour
- 2,109
- 2
- 17
- 24
130
votes
5 answers
What are the problems that are mitigated by not allowing nested function declarations in Go?
Lambdas work as expected:
func main() {
inc := func(x int) int { return x+1; }
}
However, the following declaration inside a declaration is not allowed:
func main() {
func inc(x int) int { return x+1; }
}
For what reason are nested…

corazza
- 31,222
- 37
- 115
- 186
130
votes
15 answers
Placement of the asterisk in pointer declarations
I've recently decided that I just have to finally learn C/C++, and there is one thing I do not really understand about pointers or more precisely, their definition.
How about these examples:
int* test;
int *test;
int * test;
int* test,test2;
int…

Michael Stum
- 177,530
- 117
- 400
- 535
123
votes
7 answers
Defining static const integer members in class definition
My understanding is that C++ allows static const members to be defined inside a class so long as it's an integer type.
Why, then, does the following code give me a linker error?
#include
#include
class test
{
public:
…

HighCommander4
- 50,428
- 24
- 122
- 194
120
votes
3 answers
Declaring variables inside a switch statement
I saw a few answers to this issue, and I get it — you can't declare and assign variables inside a switch. But I'm wondering if the following is correct at throwing an error saying
error: expected expression before 'int'
Code:
switch (i) {
…

dizy
- 7,951
- 10
- 53
- 54
111
votes
6 answers
Declaring and initializing variables within Java switches
I have a crazy question about Java switches.
int key = 2;
switch (key) {
case 1:
int value = 1;
break;
case 2:
value = 2;
System.out.println(value);
break;
default:
break;
}
Scenario 1 -…

ironwood
- 8,936
- 15
- 65
- 114
110
votes
7 answers
C# member variable initialization; best practice?
Is it better to initialize class member variables on declaration
private List _things = new List();
private int _arb = 99;
or in the default constructor?
private List _things;
private int _arb;
public TheClass()
{
_things =…

Steve Crane
- 4,340
- 5
- 40
- 63