Archive-name: C-faq/learn-c-cpp-today Last-modified: Wednesday - October 12, 1994 Copyright (c) 1994 Vinit Carpenter All rights reserved Introduction: ------------- This is a list of a few C and C++ language tutorials available to a user. This list includes interactive tutorials, public-domain code collections, books etc. I've developed this FAQ purely as a volunteer effort as a service to the Internet community. Although every effort has been made to insure that all the information here is as accurate as possible, no guarantee is implied or intended. I welcome comments, suggestions or criticism for all the people out there on the net that read this. If you can help me make this list a little better, you will be helping a lot of people out there on the net. I am a horrible writer and an even worse speller. If you find any errors or would like to suggest any additions please feel free to email me at the address below: carpenterv@vms.csd.mu.edu What's new in this issue: ------------------------- This section of the document will point out all the new additions, corrections, updates etc. If there is enough interest, I will start producing a 'diff' version. 1. Added a second web server that has the HTML and PS version of this document. 2. Updated the information on the 'C++ on the WWW'. The address has of the web server has changes. The author also converted Dordill's C++ course to HTML which is online. 3. Updated the information in the MSDOS/Windows compilier section. 4. Added a new item called `Programming in C' that contains a great collection of C and programming items. 5. Updated the information on the C++ FAQ. I am switching to URL in place of the standard ftp and filename format. URL stands for "Uniform Resource Locator". Think of it as a networked extension of the standard filename concept: not only can you point to a file in a directory, but that file and that directory can exist on any machine on the network, can be served via any of several different methods, and might not even be something as simple as a file: URLs can also point to queries, documents stored deep within databases, the results of a finger or archie command, or whatever. File URL: --------- file://oak.oakland.edu/pub/msdos/c/00_index.txt Gopher URL: ----------- To connect to a particular gopher server, use this URL: gopher://gopher.tc.umn.edu/ News URL: --------- To point to a Usenet Newsgroups, the URL is simply: news:comp.lang.c HTTP URL: --------- HTTP stands for HyperText Transport Protocol. HTTP servers are commonly used for serving hypertext documents http://vinny.csd.mu.edu This file is posted on the 1st and the 15th of each month to the Usenet Newsgroups COMP.LANG.C, COMP.LANG.C++, NEWS.ANSWERS & COMP.ANSWERS. The HTML and postscript version of this documents are available. Here's the URL: http://ncc1701d.csd.mu.edu http://nyx10.cs.du.edu:8001/~vcarpent/learn-cpp.html NOTE: This is my Linux PC that does get inundated with request. The last time I checked the stats, there were about 27 connections every minute. If you get timed out, please try the second (nyx) link. Both of the sites will have the latest version of the document online. The most recently posted version of this document is kept on the news.answers archive on rtfm.mit.edu. You can receive it via anonymous ftp. The URL is listed below. ftp://rtfm.mit.edu/pub/usenet/news.answers/C-faq/learn-c-cpp-today If you don't have access to ftp, you can also receive this file via e-mail by sending mail to mail-server@rtfm.mit.edu with: send /pub/usenet/news.answers/C-faq/learn-c-cpp-today in the body (not subject line) of your message. You can also receive the latest version via electronic mail by e-mailing me. To: carpenterv@vms.csd.mu.edu Subject: SEND LEARN C/C++ TODAY LIST Body: ignored. Can be blank. I've written a little mailserver that doesn't always work, so please be patient. All requests will be handled within 12 hours. I am planning to move this whole distribution thing to my Linux PC which will solve all the delay problems. For now, you might want to use the news.answers archive for the latest copy of this file. A lot of tutorials discussed here are available via anonymous ftp. If you don't have ftp, you can also retrieve these files via a ftp-email gateway. To retrieve files via e-mail, send mail to ftpmail@decwrl.dec.com with the command HELP in the body of the message to receive a complete list of all commands. A typical message would look something like this: connect oak.oakland.edu chdir /pub/msdos/c binary uuencode get xxx.zip quit Some of the items discussed here are platform-dependent, but most of the items are applicable across all platforms (portable). If you have any comments, suggestions, complaints, additions, etc, please feel free to e-mail me at the following address: carpenterv@vms.csd.mu.edu If you are working on a tutorial or would like something added to this list, please e-mail me at the address given above. The Origins of C and C++: ------------------------- The 'C' programming language was originally developed for and implemented on the UNIX operating system, on a DEC PDP-11 by Dennis Ritchie. One of the best features of C is that it is not tied to any particular hardware or system. This makes it easy for a user to write programs that will run without any changes on practically all machines. C is often called a middle-level computer language as it combines the elements of high-level languages with the functionalism of assembly language. C allows the manipulation of bits, bytes and addresses- the basic elements with which the computer functions. Another good point about C is its portability which makes it possible to adapt software written for one type of computer to another. C was created, influenced, and field tested by working programmers. The end result is that C gives the programmer what the programmer wants. C offers the speed of assembly language and the extensibility of FORTH, but few of the restrictions of Pascal and Modula-2. C++ is an enhanced version of the C language. C++ includes everything that is part of C and adds support for object-oriented programming (OOP). In addition, C++ also contains many improvements and features that make it a "better C", independent of object oriented programming. C++ is actually an extendible language since we can define new types in such a way that they act just like the predefined types which are part of the standard language. If you just use C++ as a better C, you will not be using all of its power. Like any quality tool, C++ must be used the way it was designed to be used to exploit its richness. Some of the new features include encapsulation, inline function calls, overloading operators, inheritance and polymorphism. I am not going to explain what they mean here as that would simply take me away from my purpose here, but you can refer to any good C++ book or the C++ FAQ (Item 7) for more information. What do you need to get started? -------------------------------- The first thing you need is a compiler. A compiler reads the entire program and converts it into object code, which is a translation of the program source code into a form that the computer can execute directly. UNIX SYSTEM: Type cc at the % prompt. If you don't get any error messages, you probably have a C compiler . If you get an error message, try acc, gcc or g++. If any of these don't work, contact your local system administrator and ask him/her to get you a C/C++ compiler. GNU C/C++ compiler is available from a lot of anonymous ftp sites free of charge. Look into it. (I've got g++ running on my Linux box without any problems) MSDOS/Windows (IBM COMPATIBLES): There are a lot of good compilers available to you. Microsoft Quick C and Borland Turbo C/C++ are both good products for beginners. You can buy both of them for under $50.00. I use Microsoft Quick C and MS-Visual C/C++, and I prefer Quick-C for all my DOS programs as it is small, and yet very powerful. Most of my programming is now on my Linux PC with gcc/g++. (If you want a great 32 bit operating system, you should look into Linux. E-mail me for details). You can also get the DOS port of GNU C/C++ called DJGPP from oak.oakland.edu /pub/msdos/djgpp. If you are using OS/2 on your PC, you might want to look into Borland C++ 1.5, CSET++ 2.x (IBM) or GNU gcc 2.5.8 available from ftp.cdrom.com. OpenVMS (VAX & AXP) If you're on a VAX, type in CC to check and see if you have a C compiler. VAX C is not the best compiler around, but it certainly does the job. If you don't have a C compiler, look into the GNU C/C++ compiler GCC. You can get the VAX version of GCC from ftp.spc.edu via anonymous ftp. If on a AXP system, you should have access to DEC C/C++. Please contact your local system administrator or computer consultant for more site specific questions. Macintosh (Apple/PowerMac) There are three main players in the Mac compiler market: MPW (from Apple), THINK C / Symantec C++ (both from Symantec), or CodeWarrior (from Metroworks): THINK C is $225 (only a C compiler), while Symantec C++ is $375 (includes C and C++ compilers). CodeWarrior comes in three versions: bronze, silver, and gold, at $199/299/399, respectively. Bronze generates 68K code, silver generates PowerPC code, and gold generates both. All three versions include C, C++, and Pascal compilers. The Symantec C++ compiler (ver 7.0) can be bought with a cross-compiler for the PowerMac. There have been two attempts at freeware/shareware Mac C compilers: Sesame C and Harvest. Harvest C was an ambitious attempt at a production-quality freeware compiler which was later abandoned by the author. Tutorials: ---------- 1) Title: A C tutorial. Filename: C-LESSON.ZIP Author: Christopher Sawtell. E-mail: chris@gerty.equinox.gen.nz URL: ftp://garbo.uwasa.fi/pc/c-lang/c-lesson.zip This tutorial contains a complete course for you to learn the 'C' computer language itself. Some knowledge, of computers and the jargon is assumed, but complicated concepts are fully explained. This tutorial is geared towards the UNIX operating system, but everything discussed here applies across all platforms. Most of the source code included here compiles under all the platforms. This is a good effort and is worth your time. Updates to this tutorials are posted to the USENET group comp.lang.c. 2) Title: Coronado;s Generic C tutor v2.0 Filename: GENCSRC.ZIP GENCTXT.ZIP Author: Gordon Dodrill E-mail: -- URL: ftp://oak.oakland.edu/pub/msdos/c/gencsrc.zip ftp://oak.oakland.edu/pub/msdos/c/genctxt.zip This is one of the most complete tutorials out there. Once again, most of the items covered here are apply across all platforms. There are some items discussed here that are DOS dependent. The tutorial includes a manual that covers all the aspects of the C language. The archive also includes a huge collection of C code that is discussed in this tutorial. The best way to learn anything is by practical application and this tutorial does just that. A payment of $10.00 is requested by the author if you find the tutorial helpful, but the payment is not required. I think you should send in the $10.00 as a lot of time and effort went into this project. 3) Title: Thread An On-Line C Help File V 1.01 Filename: THREAD.ZIP Author: Fran Horvath E-mail: -- URL: ftp://oak.oakland.edu/pub/msdos/c/thread.zip Thread is a C language help utility. It was written by a member of the U.S.D.A. Grad School faculty to help students learning the C language. Thread is a variable record-length database, together with an index, that enables the fast lookup and display of C keywords, standard library functions, and other items. There are a few important functions missing from this help utility, but it is still a pretty good resource. Give it a shot. 4) Title: Collection of C-Snippets Filename: SNIP9404.ZIP Author: Bob Stout E-mail: bobstout@neosoft.com URL: ftp://oak.oakland.edu/pub/msdos/c/snip9404.zip This is the April 94 release of one of the biggest public domain/freeware portable C code and instruction text. According to the author, the 1.1 MB archive contains over 360 files and approximately 35% of it is PC-specific. The rest of it is completely portable. There is a piece of code for every single task starting with macros to complete cut-and-paste C code solution and utilities, along with some frequently asked questions and instructional files. This archive is a must for every programmer. If you already have SNIP0493.ZIP, get SNPD9404.ZIP which is basically the 'diff' file. 5) Title: COMP.LANG.C FAQ Filename: FAQ Author: Steve Summit E-mail: scs@eskimo.com URL: ftp://rtfm.mit.edu/pub/usenet/news.answers/C-faq/faq The FAQ (Frequently Asked Questions) is a compilation of frequently- asked questions of the usenet group, COMP.LANG.C along with the answers. Steve's put in a lot of work and this compilation shows it. I found that the FAQ answered a lot of my questions. I even learned a lot of new things browsing through the document. I think this FAQ should should be on your computer desk right next to a good C programming book. The FAQ is posted to COMP.LANG.c and news.answers every month along with the diff version. 6) Title: TUTOR v3.10 Filename: CTUTORDE.ZIP Author: Gordon Dodrill E-mail: rowe@netcom.com URL: ftp://oak.oakland.edu/pub/msdos/c/ctutorde.zip This is an educational learning tool which helps expedite the difficult process of learning the C Programming Language. It includes a tutorial, style guide, and interactive quiz program all integrated together in one program. The tutorial covers both K&R version of C and ANSI C. One of the biggest limitation of this tutorial is that it is only available for DOS computers. 7) Title: Programming in C Filename: CE.html Author: Dave Marshall E-mail: Dave.Marshall@cm.cf.ac.uk URL: http://www.cm.cf.ac.uk/Dave/C/CE.html This is one of the best C programming tutorials out there on the World Wide Web (WWW). See tutorial #11 for more information on the web and tools to access the web. This tutorial starts out with some basic ideas and then extends to some more advanced features of C. With the popularity of the World Wide Web, items on the web servers are going to be very popular. This is really a great tutorial and worth checking out. Some of the items discussed here are loops, arrays, string manipulation, pointers, dynamic memory allocation, I/O, UNIX, C preprocessor and some exercises. While you're out there, check out Ceilidh, the online C tutoring system. 8) Title: ANSI C for Programmers on UNIX systems. Filename: love_C.ps.z, love_C.shar Author: Tim Love E-mail: tpl@eng.cam.ac.uk URL: ftp://svr-ftp.eng.cam.ac.uk/pub/misc/love_C.ps.Z This is a really nice C tutorial geared towards people on UNIX system as the title would suggest. This document introduces C by providing sample programming tasks. One of the good things about this tutorial is that all the source code included is ANSI compliant. This tutorial also includes programming exercises to aid or gauge your progress as you go through the material (answers included in back). The tutorial covers some of the basics such as functions, pointers and string manipulation followed by some programming examples to apply the items you've just learned. There is also a section on memory allocation that illustrates the use and dangers of malloc. The section on the Make utility helped me a lot as I really don't like make and makefiles. The section of debugging is also extensive and has some great tips. The appendix of this tutorial also has a section of converting from K&R to ANSI C. Really great job and well worth the checking into. 9) Title: Coronado Enterprises C++ Tutorial (v2.20) Filename: CPTUTS22.ZIP CPTUTT22.ZIP Author: Gordon Dodrill E-mail: -- Phone: (505) 293-5464 URL: ftp://oak.oakland.edu/pub/msdos/cpluspls/cptuts22.zip ftp://oak.oakland.edu/pub/msdos/cpluspls/cptutt22.zip Just like its C counterpart, this is really one of the best and most complete C++ tutorial out there. This tutorial is not for the person just starting out in programming as C++ is not an ideal first language. But if you are familiar with C or any other programming language, this tutorial will get you started with C++. All the source discussed in this tutorial is included and learning is really accelerated as you can compile the code while you are reading about it. This tutorial will assume a thorough knowledge of the C programming language and little time will be spent on the fundamental aspects of the language. Special attention has be devoted to explaining the newer additions as provided by the ANSI-C standard, as many programmers are used to the old K&R school of thought.