home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / amiga / programm / 17929 < prev    next >
Encoding:
Internet Message Format  |  1992-12-29  |  4.7 KB

  1. Xref: sparky comp.sys.amiga.programmer:17929 comp.sys.amiga.introduction:1718
  2. Path: sparky!uunet!sybus.sybus.com!myrddin!tct!deep6!nifty.UUCP!fgd3
  3. From: fgd3@nifty.UUCP (Fabbian G. Dufoe, III)
  4. Newsgroups: comp.sys.amiga.programmer,comp.sys.amiga.introduction
  5. Subject: Re: How should I learn C?
  6. Message-ID: <fgd3.03bx@nifty.UUCP>
  7. Date: 29 Dec 92 12:15:03 EST
  8. References: <78849@hydra.gatech.EDU>
  9. Distribution: world
  10. Organization: Fabbian G. Dufoe, III
  11. Lines: 83
  12.  
  13. In article <78849@hydra.gatech.EDU> gt6758b@prism.gatech.EDU (Michael Maverick Kopack) writes:
  14. >Could somebody please tell me how I should go about trying to learn C? I've
  15.  
  16.    There is no easy way to learn C.  The best starting point remains "The C
  17. Programming Language" by Kernighan and Ritchie.  You'll encounter many
  18. references to it as "K&R".  Sometimes you'll see the second edition called
  19. "K&R2" to distinguish it from its predecessor.  Get K&R and work through
  20. each exercise as you read it from cover to cover.  That will give you a
  21. basic understanding of how C works.  Be prepared for some hard work.  You
  22. don't pick up C overnight.
  23.  
  24. >gotten SAS/C 6.1, but really don't understand what I'm doing with it. My
  25. >programming experience has been limited to PASCAL and BASIC and LISP. Heck,
  26. >they don't even teach C here at GT!  I co-op with a government research center
  27. >and they have taught me a little, but I'm having a really big problem 
  28. >understanding the stuff with pointers.
  29.  
  30.    Everybody has trouble with pointers in C.  Once you understand it,
  31. though, you will appreciate its power and convenience.  C's pointer notation
  32. is especially confusing for Pascal programmers because both use the "->"
  33. operator but the meaning is different in each language.
  34.  
  35. >I have been reading through a book called "C as a second language for PASCAL
  36. >programmers" and have the most recent copy of the CManual disks in the Fish
  37.  
  38.    I'm not familiar with "C as a Second Language for Pascal Programmers" but
  39. I don't think you will find any shortcuts to learning C.
  40.  
  41. >collection printed out. Are there any resources I could use that would give
  42. >me a good, solid understanding of C.... I don't care about being able to do all
  43. >the wiz-bang graphics and such yet, I just want to be able to write a few
  44. >useful programs in C for my Amiga!
  45.  
  46.    K&R.  See above.
  47.  
  48.    Learning to program the Amiga in C is even harder than learning to
  49. program in C.  Start by learning C.  Learn to write programs that use
  50. standard input and standard output.  Stick with C's standard library
  51. functions.  Once you've mastered that, you can start branching out to the
  52. Amiga.lib functions.  There's just too much material to handle it all at
  53. once.
  54.  
  55. >There are a lot of things about C that I find very frustrating after comming
  56. >from a decent course in Pascal. For one is the way that Arrays are handled.
  57. >I like being able to do stuff like    array [6..26] of int whereas in C you
  58. >get forced into calling the indeces 0-19. I also HATE that there are no true 
  59. >pass by reference parameters! 
  60.  
  61.    If you want to learn C the first thing you have to do is accept it as it
  62. is.  It doesn't do any good to complain about its deficiencies with respect
  63. to other languages.  It doesn't matter that you wish C had the same features
  64. as Pascal--it doesn't.  Don't waste energy worrying about such things.
  65.  
  66. >It seems that C pretty much took Pascal and threw all the rules out the window!
  67. >I can't imbed functions so other procedures can't see them (scoping rules),
  68.  
  69.    In C you group those functions in a separate source file and declare the
  70. ones which are to be private as "static".  Nothing outside the source file
  71. in which it is declared can see a static variable or function.
  72.  
  73.    Everything you need to write good programs is in C, you just have to
  74. learn how a different language works.
  75.  
  76. >I have to use global variables a lot (taught as a no-no at GT) and it just
  77. >seems like C is TOO flexible! How do you guys get anything done when there are
  78. >about 500 different ways to do it?
  79.  
  80.    Don't use global variables!  Learn to pass arguments.  You can pass
  81. arguments by reference by simply passing a pointer to the variable.
  82.  
  83.    I might help if you understand one of the things that makes C different
  84. from other programming languages.  C is a high level language for doing the
  85. kind of things you normally do in assembly language.  People write programs
  86. in assembly language because they want to do things that other languages
  87. won't let them do.  C gives you that kind of power within a high level
  88. interface that insulates you from certain hardware differences.  Don't look
  89. for it to be another high level applications programming language.
  90.  
  91. --Fabbian G. Dufoe, III
  92.    350 Ling-A-Mor Terrace South   | GEnie:    F.DUFOE3
  93.    St. Petersburg, Florida  33705 | internet: fgd3%nifty@tct.com
  94.    813-823-2350                   | uucp:     ...tct!deep6!nifty!fgd3
  95.  
  96.