F
fctk
are the following rules correct in C89/C90?
----
SCOPE RULES
1) the scope of an identifier declared inside a block is the block in
which it is declared;
2) when you have nested blocks (extern block and internal block), an
identifier declared in the external block is known also in the internal
block, while an identifier declared in the internal block is not known
in the external block; (*)
3) when you have parallel blocks (first block and second block), an
identifier declared in the first block is not known in the second block.
(*)
- for variable names, an identifier declared in the external block is
known also in the internal block only if it is not re-declared in the
internal block
- for function names, an identifier declared in the external block
cannot be re-declared in the internal block
----
these rules are not written in any book; i wrote them myself. i'd only
want to know if they are correct.
thanks.
----
SCOPE RULES
1) the scope of an identifier declared inside a block is the block in
which it is declared;
2) when you have nested blocks (extern block and internal block), an
identifier declared in the external block is known also in the internal
block, while an identifier declared in the internal block is not known
in the external block; (*)
3) when you have parallel blocks (first block and second block), an
identifier declared in the first block is not known in the second block.
(*)
- for variable names, an identifier declared in the external block is
known also in the internal block only if it is not re-declared in the
internal block
- for function names, an identifier declared in the external block
cannot be re-declared in the internal block
----
these rules are not written in any book; i wrote them myself. i'd only
want to know if they are correct.
thanks.