EG H167          1:30 Sec.          Winter 2001          Daily Assignment D17Advanced

 

For the D17 Advanced assignment:

 

1.          Complete the regular D17 assignment which introduces use of structs for building derived data types consisting of a collection of primitive data type.

 

2.          Complete the following as additions to your program in Step 1 above:

 

a).  In D17 (the version provided in the assignment), you will notice that a simple form of the "gets" function is used to read in the value for the member "name".  You may also have used "gets" to read in a value for the new member of type char and length 4.  Run your program again and be "malicious" by typing in extra long character strings for the name and the other character string member.  Describe what happens?

 

____________________________________________________

 

____________________________________________________

 

____________________________________________________

 

____________________________________________________

 

b).  Determine how to fix the problem(s) you discovered in a) above, implement the fix, and test it.  Turn in this revision to your program as your D17a part of the assignment.  (Hint: Is there another form of "gets" or "fgets" that might be used?)