I know this may sound like a very basic/dumb question. But to put an example in Pascal,
Program prueba ;
var
a : integer ;
begin
write(a) ;
end.
For example, if I were asked what the write(a) prints on the screen, what would it print?
I know this may sound like a very basic/dumb question. But to put an example in Pascal,
Program prueba ;
var
a : integer ;
begin
write(a) ;
end.
For example, if I were asked what the write(a) prints on the screen, what would it print?
The documentation says in perfect Spanish
Which more or less says that Pascal doesn't initialize them when declaring them and they can contain anything. Thus, it is healthy to declare and initialize them before using them for the first time, taking into account the corresponding scope .
They also indicate that there are two exceptions to this behavior:
And remember that they are always initialized, they occupy space in memory only when the program reaches the corresponding scope.
P.S. It's not a silly question. It is, in fact, very important and asking these kinds of questions is what prevents future bugs. In general, initializing and checking the initial value is good practice (except in cases where certain data types ensure a useful default value, thus saving you the trouble of getting everything ready to work). But to do this with certainty there is always to review the documentation).