The Basics of C Programming 2019

C is a general-purpose, procedural, imperative computer programming language
developed in 1972 by Dennis M. Ritchie at the Bell Telephone Laboratories to develop
the UNIX operating system. C is the most widely used computer language. It keeps
fluctuating at number one scale of popularity along with Java programming language,
which is also equally popular and most widely used among modern software
programmers.


In 1978, Brian Kernighan and Dennis Ritchie produced the first publicly available
description of C, now known as the K&R standard.
The UNIX operating system, the C compiler, and essentially all UNIX application
programs have been written in C. C has now become a widely used professional
language for various reasons.
  • Easy to learn
  • Structured language
  • It produces efficient programs
  • It can handle low-level activities
  • It can be compiled on a variety of computer platforms

Why use C

C was initially used for system development work, particularly the programs that makeup the operating system. C was adopted as a system development language because it
produces code that runs nearly as fast as the code written in assembly language. Some
examples of the use of C might be:
  • Operating Systems
  • Language Compilers
  • Assemblers
  • Text Editors
  • Print Spoolers
  • Network Drivers
  • Modern Programs
  • Databases
  • Language Interpreters
  • Utilities

Setup & Installation

1. Download DOSBox for your version of Windows.

2. After the download completes, run the setup and install DOSBox on your
computer.

3. Now download Borland Turbo C to your computer.

4. After the download completes, extract all the contents of the ZIP file into
“C:\TC\“. It should look like this after extraction.

5. Now open up DOSBox from the shortcut on your desktop or from the Start Menu.
You should be shown with the following screen.

6. Type in the following lines one by one and hit Enter/Return after every line.
mount c: c:\
c:>cd tc
Turbo C start to install now. Press Enter to Continue and enter the Drive Source
Letter as C and press enter. Leave the next setting as it is and press enter.

7. After the installation completes, you will be back on the main DOSBox screen. At
this stage, close DOSBox by typing in “exit” or by clicking the cross (X) button
on the top.

IDE (Integrated Development Environment)

The C Developing Environment is a screen display with windows and pull-down menus.
The program listing, error messages and other information are displayed in separate
windows. The menus may be used to invoke all the operate

The default directory of Turbo C compiler is c:\tc\bin. So to invoke the IDE from the
windows you need to double click the TC icon in the directory c:\tc\bin.
The alternate approach is that we can make a shortcut of tc.exe on the desktop.

Opening New Window in Turbo C

To type a program, you need to open an Edit Window. For this, open file menu and click
“new”. A window will appear on the screen where the program may be typed.

Writing a Program in Turbo C

When the Edit window is active, the program may be typed. Use the certain key
combinations to perform specific edit functions.

Saving a Program in Turbo C

To save the program, select save command from the file menu. This function can also be
performed by pressing the [F2] button. A dialog box will appear asking for the path and
name of the file. Provide an appropriate and unique file name (the C programs are written
into text files with extension ".c" for example hello.c). You can save the program after
compiling too but saving it before compilation is more appropriate.

Making an Executable File in Turbo C

The source file is required to be turned into an executable file. This is called “Making” of
the .exe file. The steps required to create an executable file are:
1. Create a source file, with a .c extension.
2. Compile the source code into a file with the .obj extension.
3. Link your .obj file with any needed libraries to produce an executable program

All the above steps can be done by using Run option from the menu bar or using key
combination Ctrl+F9 (By this linking & compiling is done in one step).

Compiling and linking in the Turbo C IDE


In the Turbo C IDE, compiling and linking can be performed together in one step. There
are two ways to do this: you can select Make EXE from the compile menu, or you can
press the [F9] key

Correcting Errors in Turbo C

If the compiler recognizes some error, it will let you know through the Compiler window.
You’ll see that the number of errors is not listed as 0, and the word “Error” appears
instead of the word “Success” at the bottom of the window. The errors are to be removed
by returning to the edit window. Usually these errors are a result of a typing mistake. The
compiler will not only tell you what you did wrong, they’ll point you to the exact place in
your code where you made the mistake.

Executing a Programs in Turbo C

If the program is compiled and linked without errors, the program is executed by
selecting Run from the Run Menu or by pressing the [Ctrl+F9] key combination.

Exiting Turbo C IDE

An Edit window may be closed in a number of different ways. You can click on the
small square in the upper left corner, you can select close from the window menu, or you
can press the Alt+F3 combination. To exit from the IDE, select Exit from the File Menu
or press Alt+X Combination.

Comments

Popular posts from this blog

What is Burp Suite and how to hack facebook or any username and password using burp suite.

5 Android Viral Games That You Must Play In 2019