C/Before you start

From Wikiversity

< C
Jump to: navigation, search

Contents

[edit] This course is for you

If you have never programmed before this course is for you. It is written in a simple and easy to understand language. The C language provides a basis for understanding core programming concepts. If you know how to program in C, you can learn C++, Java, and many other languages. C++ was derived from C and is largely based on it.

[edit] What's included ?

This course will tell you about the fundamentals of C language.

Variables
Assignment
Input and Output
Calculation
Repetition using for and while loop
Conditional statements using 'if'
Functions to perform tasks
Arrays to store a series of data
Structures to define your own data type
C programming under Linux

[edit] The language C

Ken Thompson (left) and Dennis Ritchie (right)

C is widely used in education, in application programs like text editors, windows based applications, in games like Quake III, in calculations like finding interest, for sorting, maintaining and organizing large amounts of data. C programs are used in engineering applications like plotting of curves, integration and many more things. C has been used in very complex things also, e.g. Operating systems like Microsoft Windows, GNU/Linux and other Unices (SunOS, FreeBSD, et al) have also been written partly in C.

C was developed by Denis Ritchie in the 1970s, at the AT&T Bell Laboratories in Murray Hill, New Jersey. Developers of UNIX needed a small and compact language to write their UNIX code. Thus, C was written jointly by Ken Thompson and Dennis Ritchie. The first book on C which gave an informal specification was written by Dennis Ritchie and Brian Kernighan. Brian Kernighan was a computer scientist at AT&T and Bell labs. He is also the author of the famous Hello World program.

[edit] You will Need

To learn C programming, you will need a computer with an operating system like Microsoft Windows, GNU/Linux, UNIX, etc. Also, you will need a C compiler, like Turbo C, or The GNU C Compiler (gcc). If you use a UNIX-based platform such as FreeBSD or GNU/Linux, a C compiler is generally shipped with it, you can most likely access it by typing cc. Here on, I will make use of only Turbo C. So I will show you the step-by-step procedure to install and use Turbo C.

You can download it by googling Turbo C, or by clicking here.

After downloading the setup file, open it by double clicking it, and then unzip it, to the default folder C:\TC\. Thats it you are all done. Now the installation is over.

Instead of using Turbo C, you can also download and use: Tiny C Compiler, Dev-C++ and/or Code::Blocks ( this is a cross platform IDE ). All are free software (you may call it "open source") under the terms of the GPL and are free of charge. Dev-C++ is generally aimed at Windows 32-bit platforms, it would probably work best on Windows NT based systems (XP, 2000, etc.) and Code::Blocks is being developed for Windows, Linux, and Mac OS X ( it also supports multiple compilers, including MinGW / GCC, Digital Mars, Microsoft Visual C++, Borland C++, Watcom and the Intel C++ compiler ).

[edit] Compilers

[edit] To write a C program

First navigate to C:\TC\Bin. Inside the Bin folder you will find the file "TC.exe". Double click it. You will get an editor with a blue screen. You will type all your C programs here. Here is a screen shot of Turbo C .You may see a similar one on your screen.

Image:Turbo-c1.jpg

[edit] Exercises are good for you

After doing this course you will be familar with the C language, but to be fluent and confident you need to do all the programs yourself, and slowly develop the ability to write your own new programs.

[edit] Pointers

One of the very important features of C language is pointers. Pointers is also a hard topic to understand. Most students find it difficult to grasp the concept of pointers at first shot. But in this course, you will find that pointers were not as difficult as you thought.

[edit] Have Fun!

Finally, I would like to tell you, that programming can be a lot of fun. If you have that constant urge to learn, to know more, if you are inquisitive, then learning C is not only a good experience, but also fun.

[edit] Warning

C is an easy language to write badly. The design of the language is such that much is left to the programmer to get right. For example, the Standard C compiler will not check if you have accessed an array beyond its range; or if a pointer has been initialised. Type checking is weak, so types can be converted silently. Therefore, knowing and understanding ANSI/ISO C is very important, as is understanding which constructs are portable and which are specific to particular implementations (for example, the header file <conio.h> is not defined by the C Standard).

[edit] See also


Project: Topic:C
Previous: Topic:C — C/Before you start — Next: Introduction to C
Personal tools