:: Re: [DNG] [OT] [Re: Studying C as t…
Etusivu
Poista viesti
Vastaa
Lähettäjä: Irrwahn
Päiväys:  
Vastaanottaja: dng
Aihe: Re: [DNG] [OT] [Re: Studying C as told. (For help)
On Tue, 21 Jun 2016 14:42:46 +0200, Edward Bartolo wrote:
[...]
>     if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {

[...]
You should *never* assume that the latin letters occur in
the execution character set in ascending consecutive order.
(Though similar *is* guaranteed for the digits '0' to '9'!)

Also, I believe the exercise expects you to just count
frequencies of different characters, and not distinguish
between letters, digits, punctuation etc., and ignore
the notion of uppercase/lowercase altogether.

For character classification and case conversion you should
read up on the C library functions declared in the ctype.h
header. I suggest to save that for a later time, though.

HTH, Regards
Urban