CIS3355:
Business Data Structures |
Why are strings different from numeric arrays and how do we deal with them?
A string exists only as a sequence of characters terminated by a special character known as the null character. The null character is actually an ASCII zero. A numeric array is a data structure in which contains a fixed number of contiguous storage elements all of the same data type. In conclusion a numeric array and string are the same except for two things: Conclusion: A numeric array and a character array arethe same except for these two things: Numeric arrays contain numeric values and not character values. Numeric arrays dont use a terminating null zero (\0).
We deal with strings by assigning a string of characters as follows:
mystring[0] = 'H';
The following are references for additional information on strings:
http://www.zend.com/zend/tut/using-strings.php#intro
http://www.php.net/manual/en/language.types.string.php
http://www.cplusplus.com/doc/tutorial/tut3-2.html
1. Do you have to use the maximum number of characters assigned?
No, you do not. Please refer to the following demonstration.
2. What are the two main differences between a string and a numeric array?
The two main differences between a string and a numeric array are: a) numeric arrays contain numeric values b) Strings use null to terminate value
3. Null represents what decimal value?
a) 1 b) 2 c) 3 d) 0
(Answer: d) 0)
4. How do we determine the address of an array?
a) base address b) offset/script c) base address plus offset/script
(Answer: c) base address plus offset/script)
|