1. Descriptor is a collection of the attributes of a variable

2. Row major order is the element of the array that have their first subscript the lower bound value of that subscript are stored first, followed by the elements of the second value of the first subscript. Column major order, the elements of an array that have as their last subscript the lower bound value of that subscript are stored first, followed by the elements of the second value of the last subscript.

4. First, the length can be static and set when the string is created. Such string is called static length string. Second is to allow strings to have varying length up to a declared and fixed maximum set by variable’s definition as exemplified by the strings in C and the C-style strings of C++. This are called limited dynamic length strings. The third option is to allow strings to have varying length with no maximum.

5. ordinal type is one in which the range of possible values can be easily associated with the set of positive integers.

Enumeration is one In which all of the possible values, which are named constant, are provided a way of defining and grouping collections in the definition.

Subrange type is contiguous subsequence of an ordinal type.

 

8. design issue for arrays

-What types are legal for subscripts?

-Are subscripting expressions in element references range checked?

-when are subscript range bound?

-What dose array allocation take place ?

-Are ragged or rectangular multidimensioned array allowed, or both?

32.

-Should type checking be required? Note that any such type checking must be dynamic.

-should unions be embedded?

33. no. The user can tell the system when the type checking can be static. Such a restricted variable is called constrained variant variables.

45. strongly typed if type errors are always detected.

49. C and C++ are not strongly typed languages because both include union types, which are not type checked.

50. Name type equivalence means that two variables have equivalent types if they are defined wither in the same declaration or in declaration that use the same type name.

51. Structure type equivalence means that two variables have equivalent types if their types have identical structure.

Problem set

2. The value of integer, will negative if the left-most value is 1.

7. pointer in C++ can be used in the same ways as addresses are used in assembly languages. Meanwhile References type in C++ is a constant pointer that is always implicitly dereferenced.

9.  Struct is used to some member with different data type.Union is used to specify union structured. Union you are only supposed to use one of the elements.

19. Typedef in C, we have to use keyword “typedef”. But in C+ +, we don’t need to do that.

Advertisements