Image Loading... Image Loading...
Click Here to Visit Our Sponsor

Home
News
Cartoon

Books
Reviews

SimTel
Compress
Database
Delphi
Desktop
Diskutl
Fileutl
Graphics
Inet
Mmedia
Prog
Scrsave
Util

C/C++
CodeBase!
Libraries
Tutorials
WebLinks

Pascal
Libraries
WebLinks



Home / C Tutorials
The C language
Introduction
by Marshall Brain
Thursday, May 27, 1999

Published with kind permission of DevCentral
Copyright © 1998 Interface Technologies, Inc. All Rights Reserved.


What's C?

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.

Possible problems

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.

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


This Article
Introduction
A simple program
Branching/looping
Arrays
C Details
Functions
Libraries/makefiles
Text files
Pointers
Parameters
Dynamic structures
Pointers and arrays
Strings
Operator precedence
The command line
Binary files

NetLinks
DevCentral
DJGPP C Compiler
GNU C++ Compiler
Tendra C Compiler

Next:  A simple program

   
Image Loading...