1 March 2013

Simple C - Chapter 1, Introduction

What is C?

C is a programming language (high level language) written by Dennis Ritchie in 1972. The C language first developed at AT and T's Bell Laboratories in the United States. C is a structured programming language and gives users the ability to create subroutines, structures and loops. This language is very easy to learn due to its reliability and free format text source. C is one of the most popular and widely used programming languages. Many modern languages like C++, C#, Java, PHP and Python have been developed from the C language. It is very difficult and almost impossible to learn C++, C# and Java without knowing the C language. Even today many parts of popular operating systems (Windows, UNIX, Linux) are still written in C language. The reason for this is the C performance. Also device drivers usually are written in C language. So to be an efficient programmer, learning C is a must. Simple C is a chapter wise tutorial that techs you C in a simple method with lots of coding examples. This is the first chapter and the rest of tutorials (or chapters) will publish later.

  • C is a structured programming language
  • It is used for system programming
  • It is contains large amount of built-in functions (library functions)
  • C program has fast execution speed
  • It is a portable language
  • It is very simple to learn
  • And finally it has the features of both high level and low level languages 

C compiler

When you want to make any program, you need to write the instructions and then convert those instructions to machine language (0 and 1). So what you need is an editor like Notepad or Microsoft Word to write the instructions and a compiler to convert those instructions to machine language.

Usually a Compiler provides an Integrated Development Environment (IDE). An IDE is a software application that create a user friendly environment for programmers and software developers. There are several IDEs available in the market; Turbo C, Turbo C++ and Microsoft C are some of these IDEs that work under MS-DOS. For the Windows users, Visual C++ and Borland C++ work under the Windows and gcc compiler works under Linux operating system. You should know Turbo C++, Microsoft C++ and Borland C++ also contain C Compiler. To start, I suggest using Turbo C or Turbo C++. You can download these IDEs from the links below:

Borland C++ V5.02 (85.6Mb)

Turbo C++ V3 (3.8Mb)

Turbo C (909.1Kb)

Note: You need to install the Borland C++ before you able to use it. For installing the compiler, open the Borland C++ folder and double click on SETUP.EXE file, then follow the instruction. For using Turbo C and Turbo C++ you don’t need to install them. Just copy these files into your desired directory like C: drive. To run Turbo C, open the TUR-C folder and double click on TC.EXE file

For running the Turbo C++, open TUR-CPP V3>BIN>TC.EXE file. If you are using Windows Vista or Seven, when you double click on TC.EXE file the IDE window will open and give you a message that "This system does not support full screen mode. Choose close to terminate the application", just select ignore to enter the IDE window. 

To solve this problem, click on the top left side of the window, then from the pop down menu choose Properties. Go to font tab and select Lucida Console font and font size 28. Then go to the Layout tab, in this tab you can arrange the size of the IDE window. Just arrange it in the way that it suits you.

Steps to load edit and compile a C program

Let assume that you use Turbo C or Turbo C++ compiler, and saved it in C: directory of your system. First open the Windows Command Prompt, for this type CMD in Run and hit the Enter or select it from
Start>Programs>Accessories>Command Prompt

Now follow these steps: 

Step 1

Go to C:\>cd tur-cpp v3\bin or whatever is your compiler directory name, then C:>tur-cpp v3\bin>tc

Step 2

Select New from the File menu and type your program.

Step 3

Press F2 to save the program, Alt + F9 for compiling and Ctrl + F9 for executing the program.

In the next chapter, we will continue with some basic definition and C structure program.