home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / amiga / programm / 17878 < prev    next >
Encoding:
Text File  |  1992-12-29  |  3.4 KB  |  81 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: sparky!uunet!gatech!concert!samba!usenet
  3. From: Todd_Lewis@unc.edu (Todd M. Lewis)
  4. Subject: Re: How should I learn C?
  5. Message-ID: <1992Dec28.222652.11431@samba.oit.unc.edu>
  6. Sender: usenet@samba.oit.unc.edu
  7. Nntp-Posting-Host: guitar.oit.unc.edu
  8. Organization: UNC Office of Information Technology
  9. References: <78849@hydra.gatech.EDU>
  10. Date: Mon, 28 Dec 1992 22:26:52 GMT
  11. Lines: 68
  12.  
  13. In article <78849@hydra.gatech.EDU> gt6758b@prism.gatech.EDU (Michael Maverick  
  14. Kopack) writes:
  15. >Could somebody please tell me how I should go about trying to learn C?
  16.  
  17. A lot of it is attitude.  Hang in there and try to enjoy it.  :-)
  18.  
  19. >...solid understanding of C.... I don't care about being able to do all
  20. >the wiz-bang graphics and such yet, I just want to be able to write a few
  21. >useful programs in C for my Amiga!
  22.  
  23. Good attitude.  That's half the battle.
  24.  
  25. >There are a lot of things about C that I find very frustrating after comming
  26. >from a decent course in Pascal. For one is the way that Arrays are handled.
  27. >I like being able to do stuff like    array [6..26] of int whereas in C you
  28. >get forced into calling the indeces 0-19. I also HATE that there are no true 
  29. >pass by reference parameters! 
  30.  
  31. Oops.  Attitude problem.  There are ways work with these things and keep 
  32. a good design.  This is an attitude problem.  C will never be Pascal.
  33. That wrench just doesn't drive screws very well.  Get over it.  (I went
  34. through the same phase, by the way.)
  35.  
  36. >It seems that C pretty much took Pascal and threw all the rules out the  
  37. window!
  38.  
  39. It's more that Pascal took C and threw in a bunch of rules.  Either way,
  40. it's a different tool with lots of sharp edges.  Be careful and try to
  41. get into a C mind-set.  If you don't you will never enjoy programming C.
  42.  
  43. >I can't imbed functions so other procedures can't see them (scoping rules),
  44.  
  45. Static functions with file scope will do it.  Well-chosen function names
  46. eliminate the problem pretty much anyway.  Most of those local functions
  47. you wrote in Pascal could have been global and nothing would have changed.
  48.  
  49. >I have to use global variables a lot (taught as a no-no at GT)
  50.  
  51. That's what static variables with file scope are far.  It works a little
  52. differently, but you can get the same effect.  You just have to think a
  53. little differently about it, that's all.  Attitude.
  54.  
  55. > and it just
  56. >seems like C is TOO flexible! How do you guys get anything done when there are
  57. >about 500 different ways to do it?
  58.  
  59. There are usually only a few _good_ ways, though.  That's where skill
  60. and experience come in.  Getting to make those choices is part of what
  61. makes C programming fun.
  62.  
  63. >Please, open my mind to C! I'd hate to have to try to do everything for my 
  64. >Amiga in Pascal, considering how much of the Amiga software is written in 
  65. >and documented for C......
  66.  
  67. I started my Amiga programming in Modula-2.  This was a good thing, because
  68. I had to really understand every line of every example program I studied to
  69. be able to translate it to M2.  I came away with a much better understanding
  70. of the Amiga and C because of it.  I use C these days, but now I know _why_ I
  71. use C.
  72.  
  73. >Thanks a million,
  74. >Mike Kopack
  75.  
  76. Looking forward to some great programs from you!  Hang in there.
  77. --
  78.  _/_/_/  _/     Todd_Lewis@unc.edu          You can lead a horse to 
  79.   _/    _/     utoddl@guitar.oit.unc.edu   Mohammad, but you can't make
  80.  _/    _/_/_/                             a mountain drink a mole hill.
  81.