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