"Graphing" in tiny-c Ken Owen's solution to the foxtrot exercise (in Perl) used the function split which made me think such a function would be useful in tiny-c. I modified my graph.tc program (which involves date / amount data separated by a space) to use such a split function. split takes 3 arguments: split int t(0);char s(0),delim(0) [ ] Note: When "arrays" are arguments to a function, you always use 0 in the parentheses even though what you pass to it will usually have a non-zero value in the array declaration. If the string s had "2009/11/22 50 2009/12/29 25 " and the string delim had " " you would get
t(0)="2009/11/22" Here's a program that takes date / amount data and produces a horizontal bar graph of it. http://primepuzzle.com/tc/graph.tc Here's what it generates.
|