The following declarations are given for a language that uses name equivalence:
A, D: array [1..100] of int;
C: array [1..100] of int;
F: array [1..100] of int;
The question is: "Explain which of these four variables have the same type. Furthermore, which ones have different types?"
How do I determine type equivalence in this context?
I believe that A and D would be name equivalent - because both use the same assignment - but all the options are structurally equivalent, because they all use array [1..100] of int
.
Name equivalence of types means "structural equivalence without name substitution"*.
Because all your variables have struturally equivalent types, not containing any differently named types (their differing variable names and seperate declarartions are not relevant to type checking), their types are name equivalent, i. e. The four variables have the same type.
*http://web.eecs.utk.edu/~bvanderz/teaching/cs365Sp12/notes/types.html