--- Àíàòîëèé Àëåêñååâè÷ Âîðîáåé <ga...@re...>
escribió: > Thank you, guys, for your help.
> I think now I've got enough information to get on with my work.
>
> By the way, what I have to sort is a large array of strings.
Just a thought. You can use the function strcmp (defined in string.h).
Unlike most comparison operations in C, the string comparison functions
return a nonzero value if the strings are not equivalent rather than if
they are. The sign of the value indicates the relative ordering of the
first characters in the strings that are not equivalent: a negative
value indicates that the first string is "less" than the second, while
a positive value indicates that the first string is "greater".
The most common use of these functions is to check only for equality.
This is canonically done with an expression like ! strcmp (s1, s2).
Here are some examples showing the use of strcmp. These examples assume
the use of the ASCII character set. (If some other character set--say,
EBCDIC--is used instead, then the glyphs are associated with different
numeric codes, and the return values and ordering may differ.)
strcmp ("hello", "hello")
=> 0 /* These two strings are the same. */
strcmp ("hello", "Hello")
=> 32 /* Comparisons are case-sensitive. */
strcmp ("hello", "world")
=> -15 /* The character 'h' comes before 'w'. */
strcmp ("hello", "hello, world")
=> -44 /* Comparing a null character against a comma. */
hth
Chemanuel
_______________________________________________________________
Do You Yahoo!?
Yahoo! Messenger: Comunicación instantánea gratis con tu gente -
http://messenger.yahoo.es
|