Hello!
Can somebody explain the difference between fields and variables.
For me they are more or less the same.
Two words for the same thing
In the abstract computing science use of the term, "field" refers to a
congiguous portion of a record. In C records are often represented by
structs, so a field may very well be represented by a portion of a
struct.
In the abstract computing science use of the term, "variable" is any
value that is not a constant (and thus cannot reside permanently and
exclsively in code space).
So, a field implies, but does not require, some higher level of
organization (such as a record) and implies, but does not requre, some
lower level of organization (such as a variable).
Variables may be scalar, vectors, matrices, bases, or higher
organizations of any of these and may be homogeneous or heterogenous
variations of any of these. One might legitimately use the term
"field" to describe one section of a heterogeneous vector (or even one
slab of a homogeneous basis).
All that having been said, the most common use of the term "field" in
C will occur with reference to a character array within a struct.