[Courses] Re: [Newchix] Learning to Program in C.

Amanda amanda5 at sonic.net
Thu Feb 21 14:55:13 EST 2002


At 12:56 PM 2/21/2002 -0800, Akkana wrote:
>Amanda writes:
>> If you are going to tackle a language on your own (that is, not take a
>> class with a qualified instructor that will point out the deep meanings)
>> then please take the time to read slowly and contemplate the concepts you
>> read about and write small snipetts of code to play with the concepts.
>
>It's true that it helps to read slowly and try the examples
>as much as you can, especially if you're on your own.
>
>Fortunately, anyone reading this isn't on her own, because there's a
>C course going on on the linuxchix "courses" list, and there's help
>available on the IRC channel -- if there's no one on #c, try #linuxchix,
>since most of the chix who hang out there are more than happy to answer
>programming questions.  Don't be afraid to ask!
>
>> 	i  =  ++j   +   ++j    *   ++j;
>
>Sure, C can do confusing things.  But frankly, most C programmers
>wouldn't use a construct like this, and I would hope that beginners
>wouldn't be confronted with something like it.

Well actually in an instructor taught class the issues of pre and post
side-effects of ++ and -- are brought in the first lession on expressions.
It is important to known why you should not form and expression like the
one above.  It reappears working with arrays.  The expression above is
really bad programming and completely not-portable.  BUT the language
grammar allows it SO it is a beginners trap waiting for the unwary.  It
also makes for a great quiz question. AND of course "its not a bug its a
feature." ;-) 
 
>
>Raven wrote, a few days ago:
>> I doubt that I'll need to generate
>> Fibonacci numbers or print "Hello World" any time soon.  I need to
>> figure out things like how to write a program that checks the body of
>> incoming mail messages against a file, and /dev/null's them if there's
>> any match in content.  That way I can stop getting the same spam to each
>[ ... ]
>>         Maybe I'm trying to fly before I can crawl.  But very few of the
>> programming examples that I've come across talk about how to integrate  
>> your program with existing applications or systems.
>
>As it happens, I have a fairly simple little C program that I use
>for spam filtering.  The current incarnation of the program is called
>"isenglish.c" and attempts to guess whether a string is in English
>or not (a lot of spam seems to be in garbled asian charsets but
>doesn't have an appropriate mime header to let me filter it out
>on that basis).  It does fairly simple things like count the number
>of vowels vs. consonants, letters vs. digits and punctuation, average
>word length, etc.
>
>It's a very simple program: small but not tiny (currently 137 lines).
>It requires understanding int arrays and char arrays, subroutine calls,
>and a few other concepts which would be easy to explain (how to
>handle runtime arguments argc and argv, how to use a few common
>standard library calls like isspace() and isalpha()).
>So, no, Raven, I don't think you're asking for too much -- basic
>pattern matching is really quite easy in C and I don't think it
>would be beyond a motivated beginner who was a few chapters into
>the C book.
>
>I've been thinking about improving the program to do some smarter things
>(count letter frequencies and compare with the real letter frequencies
>for a particular language, or look for particularly spammish sequences).
>I don't want to horn in on the C course, but I wonder if those of you
>who are taking the course might be interested in seeing how a program
>like this is developed?  I could do a series of postings where I explain
>how this program was written, and then if people are interested I could
>continue and add some of the features I've been considering, explaining
>what I'm doing as I go.
>
>Would this be interesting to anyone?  Please let me know.
>I suggest following up to courses, not newchix, and I've attempted
>to direct followups there.
>
>	...Akkana
>_______________________________________________
>Newchix mailing list
>Newchix at linuxchix.org
>http://mailman.linuxchix.org/mailman/listinfo/newchix
> 



More information about the Courses mailing list