PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs223] Use of Arrays
Date: Sunday, 22 Mar 2020, 13:02:40


    > Message Posted By: Unknown
    >
    > The spec says, "Qsort may not use any arrays other than argv[] and the
    > strings returned by getline()." Just to clarify, may we use array notation
    > then to deal with the strings returned by getline at any point in our
    > code? Even after we have stored all the lines in deques and are at the
    > point of implenting the sorting algorithm itself? ...

Yes, you may use array NOTATION (which is just syntactic
sugar), as long as no storage is allocated as a result.
=====
						    ... I am unsure how to
    > compare two strings without using array notation to loop through
    > individual characters in strings, comparing them one by one, unless you
    > prefer we use pointer arithmetic.

As stated in the specification,

  7. The ordering of the keys associated with each line is that defined by
     strcmp() or strncmp() when the environment variable LC_COLLATE is set to
     the value specified in the individual test scripts (normally "POSIX").
     Thus you must compare keys using one of these functions.

If you do not do so, your code will fail several of the
Phase 4 tests.

--Stan-
PREV INDEX NEXT