A Magellan Four Star Site Iftech.comHomeAbout ITIGuestbookSearch ITI

Online Training CenterHelp

Introduction to C Programming

Introduction

by Marshall Brain (questions@iftech.com)
The second edition of "Developing Professional Applications in Windows 95 and Windows NT Using MFC" is now available. This book is filled with tons of great examples and code to get you up and running with VC++ 4.2 and beyond! See the book description and TOC for more information. Order online from amazon.com


C is an easy language to learn, especially if you already know Pascal or some other procedural language. Every concept in Pascal maps directly to a concept in C: The ideas are exactly the same, but you use different words to express them. C sometimes seems difficult because it gives the programmer more freedom, and therefore makes it easier to make mistakes or create bugs that are hard to track down.

These tutorials introduce you to C by showing you how Pascal maps to it. It also introduces several concepts not found in Pascal. Most of these new concepts deal with pointers. Readers coming from a Fortran, Cobol, BASIC, etc. background should find that the Pascal code is easy to read.

I believe that the only way to learn C (or any language) is to write and read a lot of code in it. One very good way to get C programming experience is to take existing programs that you have already written and convert them. This way, if the program does not work in C, you know that the translation is causing the problem and not the original code.

One major difference between Pascal and C causes problems: C does not allow nested procedures, so you must remove any in order to convert Pascal programs. You should avoid nested procedures in your Pascal programs altogether or remove nesting from programs in the Pascal version. That way, you can retest the program in the Pascal environment before you move it over to C.

Also watch case sensitivity in C. C compilers consider uppercase and lowercase characters to be different: XXX, xxx, and Xxx are three different names in C. By convention, constants in C are spelled with uppercase, while variables are spelled with lowercase, or an uppercase/lowercase combination. C Keywords are always lowercase.

In this tutorial, all compilation instructions and references to man pages assume that you are working on a fairly normal UNIX workstation. If you are not, you will have to use the manuals/help files for your system to map the instructions to your environment.

A note on compilers:
If you do not have $300 to spend on a commercial compiler from the likes of Microsoft, Borland or Symantec, then you can use one of the free compilers available on the web. See http://www.rt66.com/~brennan/djgpp/ as a starting point in your search.

In the next tutorial we will start with an extremely simple C program and build up from there.

<- BackForward ->Return


Iftech.comHomeAbout ITIGuestbookSearch ITI

Interface Technologies, Inc.
(800)224-4965 - Highwoods Office Center - 3120 Poplarwood Ct, Suite 104 - Raleigh, NC 27604

Questions or comments about Interface Technologies products and services, email:
interface@iftech.com

Questions or comments about Iftech.com, email:
webmaster@iftech.com

© 1997 Interface Technologies, Inc

Microsoft Internet Explorer Netscape Navigator 3.0