home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / c / 18956 < prev    next >
Encoding:
Internet Message Format  |  1992-12-29  |  2.1 KB

  1. Path: sparky!uunet!mcsun!sun4nl!cwi.nl!dik
  2. From: dik@cwi.nl (Dik T. Winter)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Moving from Pascal to C, Help please!!!!!!
  5. Message-ID: <8474@charon.cwi.nl>
  6. Date: 29 Dec 92 03:55:13 GMT
  7. References: <78858@hydra.gatech.EDU>
  8. Sender: news@cwi.nl
  9. Organization: CWI, Amsterdam
  10. Lines: 30
  11.  
  12. In article <78858@hydra.gatech.EDU> gt6758b@prism.gatech.EDU (Michael Maverick Kopack) writes:
  13. ...
  14.  >                                     I co-op with a government research center
  15.  > and they have taught me a little, but I'm having a really big problem 
  16.  > understanding the stuff with pointers.
  17. Now this I do not understand.  I have heard the complaint before.  In what
  18. way is there a difficulty with C pointers when compared to Pascal pointers?
  19. (Except that in C you can use arithmetic, and they are a bit more general.)
  20.  > 
  21. ...
  22.  > There are a lot of things about C that I find very frustrating after comming
  23.  > from a decent course in Pascal. For one is the way that Arrays are handled.
  24.  > I like being able to do stuff like    array [6..26] of int whereas in C you
  25.  > get forced into calling the indeces 0-19. I also HATE that there are no true 
  26.  > pass by reference parameters! 
  27. The first is indeed frustrating and is a detriment to numerical mathematics
  28. programming in C; but the same holds for Pascal.  In Pascal all bounds are
  29. fixed by type or declaration.  Try to write in both C and Pascal a general
  30. routine that takes as input a l*m matrix and a m*n matrix and returns a
  31. l*n matrix (either through the parameter list or as a function return).
  32. Here l, m and n are parameters to the routine.  (For bonus points: write
  33. the same such that it performs well on a vector machine.)
  34.  
  35. The second is not a really valid complaint.  The difference between call
  36. by value and call by reference is specific to Pascal (inherited from Algol
  37. 60), and in fact artificial.  There is no need for such, as C shows with
  38. its pointer passing, and as Algol 68 did before by 'ref' passing.
  39. -- 
  40. dik t. winter, cwi, kruislaan 413, 1098 sj  amsterdam, nederland
  41. home: bovenover 215, 1025 jn  amsterdam, nederland; e-mail: dik@cwi.nl
  42.