Skip to main content

Questions tagged [declarations]

0 votes
1 answer
272 views

In my experience, it is customary to place local variable declarations at the beginning of their scope. Several questions in this forum ask whether this needs to be so, and their answers tend to agree ...
Severo Raz's user avatar
1 vote
2 answers
364 views

In Common Lisp, we have to use the let form to declare a new lexically-scoped variable. This means that the code either looks like that written in C89 (all variables declared on top of scope), or ...
ndsrib's user avatar
  • 19
6 votes
4 answers
2k views

When declaring a member class MyClass { AnyClass<WithLong<Generic,Declaration>> myProp = new AnyClass<WithLong<Generic,Declaration>>(); } is quite redundant. ...
Joseph Merdrignac's user avatar
0 votes
4 answers
659 views

Is there a difference between defining a variable in C and assigning a value to a variable in C? I know that declaring a variable simply means telling the name and its type like int a. On the other ...
yoyo_fun's user avatar
  • 2,297
2 votes
1 answer
99 views

Assuming declarations are expressions consider such code: if ((var x = foo()) and (var y = x)) or (var z = bar()) then println(z); end The reference to x is OK, because at this point x has to be ...
greenoldman's user avatar
  • 1,533
-2 votes
3 answers
9k views

From previous experience, I had always thought that, if you are going to use variables inside of a for loop, it was much better to declare them outside of the loop vs. inside the loop itself. I ...
user25839's user avatar
19 votes
3 answers
62k views

My instructor once told me that I should not define a variable inside a loop, but I honestly still do not understand why. What are the disadvantages of that? Could any body explain that to me?
Mo Haidar's user avatar
  • 527
0 votes
3 answers
943 views

In the third last paragraph at page number 26 of the ebook "The C Programming Language" the author(s) say, "We will generally use parameter for a variable named in the parenthesized list in a ...
user106313's user avatar
17 votes
5 answers
10k views

Consider the following "C" code: #include<stdio.h> main() { printf("func:%d",Func_i()); } Func_i() { int i=3; return i; } Func_i() is defined at the end of the source code and no ...
user106313's user avatar
20 votes
4 answers
7k views

Usually in C, we have to tell the computer the type of data in variable declaration. E.g. in the following program, I want to print the sum of two floating point numbers X and Y. #include<stdio.h&...
user106313's user avatar
0 votes
2 answers
335 views

I see a lot of code with variables declared right after the function, but when I post something like that people end up mad and say it is better to declare them when they are used. I assume this all ...
floopdagoop's user avatar
5 votes
3 answers
1k views

The question is how to cope with absence of variable declaration in Python, PHP, and the like. In most languages there is a way to let the compiler know whether I introduce a new variable or refer to ...
Alexander Gelbukh's user avatar
2 votes
2 answers
3k views

Is there any difference if I were to write something like this: int row,col; for(row = 0; row < data.length; row++){ for(col = 0; col < data[row].length;col++){ //do ...
user3189506's user avatar
1 vote
3 answers
6k views

Before forming a class in Java or other programming languages that support OOP, should I use underscore (_) in each (local or private) field declaration. More precisely: private String ...
Hakan's user avatar
  • 113
10 votes
9 answers
3k views

At the place where I work, there are explicit guidelines for placement of declarations of variables. According to that, it is required to put them at the global level and / or at the beginning of ...
TCSGrad's user avatar
  • 1,362

15 30 50 per page