home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!cs.utexas.edu!csc.ti.com!tilde.csc.ti.com!mksol!mccall
- From: mccall@mksol.dseg.ti.com (fred j mccall 575-3539)
- Subject: Re: Moving from Pascal to C, Help please!!!!!!
- Message-ID: <1992Dec29.142516.4334@mksol.dseg.ti.com>
- Organization: Texas Instruments Inc
- References: <78858@hydra.gatech.EDU>
- Date: Tue, 29 Dec 1992 14:25:16 GMT
- Lines: 90
-
- In <78858@hydra.gatech.EDU> gt6758b@prism.gatech.EDU (Michael Maverick Kopack) writes:
-
- >Could somebody please tell me how I should go about trying to learn C? I've
- >gotten SAS/C 6.1, but really don't understand what I'm doing with it. My
- >programming experience has been limited to PASCAL and BASIC and LISP. Heck,
- >they don't even teach C here at GT! 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.
-
- Pointers and recursion are the basics of the language. If you don't
- get them, you aren't going to get it at all.
-
- >I have been reading through a book called "C as a second language for PASCAL
- >programmers" and have the most recent copy of the CManual disks in the Fish
- >collection printed out. Are there any resources I could use that would give
- >me a good, solid understanding of C.... I don't care about being able to do all
- >the wiz-bang graphics and such yet, I just want to be able to write a few
- >useful programs in C for my Amiga!
-
- Get hold of a copy of Kernighan & Ritchie and read it. Then go back
- and read it again. Then read it a third time and work through the
- exercises.
-
- >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!
-
- Sure there are. What do you think passing a pointer to something IS?
- What do you think a call by reference does? What do you think Pascal
- VAR does?
-
- >It seems that C pretty much took Pascal and threw all the rules out the window!
-
- Just a bit off there. C was created to write programs. Pascal was
- created to teach BASIC principles of programming. Big difference. No
- relationship between the two (to speak of).
-
- >I can't imbed functions so other procedures can't see them (scoping rules),
-
- This is done using separate files in C. If you structure your program
- in the first place, scoping ceases to be a problem.
-
- >I have to use global variables a lot (taught as a no-no at GT) and it just
- >seems like C is TOO flexible! How do you guys get anything done when there are
- >about 500 different ways to do it?
-
- If you properly break the functionality of your program up into
- separate compilation modules, you will find yourself using what I call
- 'local globals' -- they are visible in one file, but are only used by
- related functions and aren't visible outside the 'package'. And just
- how is that different than 'scoped variables' in Pascal? Whoever
- taught you that global variables are bad should have taught you WHY
- global variables are bad. Beginning C programmers tend to overuse
- globals because they don't understand how to structure their programs.
-
- How do you get anything done when there is only one way to do it and
- that way doesn't work too well? If there is more than one way to do
- something (and there usually is), you pick the best way and do it that
- way. How do you ever get to class? There must be hundreds of paths
- you could follow to get there.
-
- >Please, open my mind to C!
-
- Well, I'm of the opinion that if you don't like it you shouldn't use
- it. If you find that you can't do the things you need to do in a
- language that you DO like, that says that the one you like is
- deficient and you need to learn another one. If you CAN do everything
- you need to do in the language that you like, then USE THAT LANGUAGE.
- Seems like one of the things they never teach people these days is the
- criteria to use when selecting a language to do a job. I hardly think
- it's up to us to 'open your mind to C' -- if you don't see any utility
- in the power of the language, use something else.
-
- >I'd hate to have to try to do everything for my
- >Amiga in Pascal, considering how much of the Amiga software is written in
- >and documented for C......
-
- Perhaps you should ask some of the people who wrote all that software
- why they did it in C and not in Pascal?
-
- [Now then, language wars are incredibly boring, so why not just ask
- questions about how to do the things you're hanving problems with?]
-
- --
- "Insisting on perfect safety is for people who don't have the balls to live
- in the real world." -- Mary Shafer, NASA Ames Dryden
- ------------------------------------------------------------------------------
- Fred.McCall@dseg.ti.com - I don't speak for others and they don't speak for me.
-