Re: K&R Exercise 6-2
- From: Eric Sosman <esosman@xxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 29 Aug 2008 08:11:25 -0400
mdh wrote:
In most of the exercises that K&R write, there seems to be a
relationship to some library function or some aspect of C that is used
later. So, quick question to those more experienced programmers. Other
than this being an illustration of the use of structs, is this
illustrative of some aspects of C that you use all the time.
Thanks as usual.
Exercise 6-2
Write a program that reads a C program and prints in alphabetical
order each group of
variable names that are identical in the first 6 characters, but
different somewhere thereafter. Don't count
words within strings and comments. Make 6 a parameter that can be set
from the command line.
The exercise seems designed to point out the difference
between strcmp() and strncmp(), in the context of a comparison
function for qsort(). So there's certainly a library tie-in,
if that's what you felt was missing.
--
Eric Sosman
esosman@xxxxxxxxxxxxxxxxxxxx
.
- References:
- K&R Exercise 6-2
- From: mdh
- K&R Exercise 6-2
- Prev by Date: Re: C99 portability challenge
- Next by Date: Re: Pointer dereference rather than sizeof?
- Previous by thread: K&R Exercise 6-2
- Next by thread: Re: K&R Exercise 6-2
- Index(es):
Relevant Pages
|