Groovy hepcat arnuld was jivin' on 23 Mar 2007 00:32:47 -0700 in
comp.lang.c.
K&R2, section1.6, exercise 1-14's a cool scene! Dig it!
>i was not even able to understand how should i proceed tow rite
solution for this exercise:
"Write a program to print a histogram of the frequencies of different
characters in its input."
Use an array of int, each element representing a character.
Initialise all elements to 0. When you read a character, increment the
coresponding element of the array.
>then i tried this: http://clc-wiki.net/wiki/K%26R2_solu..._1:Exercise_14
i did not understand the following in Histogram solution:
1.) on X-axis, all i see are "0000001111112222333" what do they
represent ?
I don't know. At a guess, possibly the different digits represent
tens. Thus 000000111111222222333 might represent 35, but only an
approximation.
>2.) Y-axis, starts from 0 and goes to 476, whereas there are only 256
characters in ASCII.
No, ASCII is a 7 bit characer set. There are 128 values in it, the
first 32 of which are control characters (including NUL, the null
character).
>i guess, Y-axis represents how many times a character occurs but how
do i know how many times 'a' occured and how many times "?" occured or
how many times a particular "character" occured ?
I don't know.
--
Dig the even newer still, yet more improved, sig!
http://alphalink.com.au/~phaywood/
"Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
I know it's not "technically correct" English; but since when was rock & roll "technically correct"?