C Language with smartness


Share Now

C Language with smartness

What is language? We very well known that the language is a medium to express anything to human being. That is to communicate between each other. If we want to communicate to a person who lives in other state and we do not know his language, then to communicate to him we require a translator. Like this to communicate to computer we require a translator. There are a lot of translators and languages available in the market. This translator becomes of two types. First is interpreter which executes (gives response) our code line by line. The other called compiler which executes the whole program together.

C-Language is a high-level programming language which was developed in the mid 1970. It was developed by Brian W. Kernighan & Dennis Ritchie. C is used a lot in embedded hardware programming where resources are scarce.

There are many compilers for C language Turbo C, Borland C and ANSI C depending upon operating system. In windows Turbo C and Borland C are used. ANSI C is used in Linux Operating System.

How to write first program in C?

void main()
    printf("Hello! C");

In this program stdio.h header file is used for giving definition of printf() to the compiler. Because we have to add header file for each function in C program.

Write this program in turbo C Editor and save with any name. To save program use F2 function key. After that press Alt+F9 to compile the program. Then Ctrl+F9 to run or execute the program.

To see the output of the program press Alt+F5, You will see the program output on the computer screen.

If you do not want to use Alt+F5 to see the result, you can use User Screen option from Window menu. Or use getch() function at the end of the program. To clear the previous result from the computer screen use clrscr() function at the beginning of the program after starting brace of main() function like this. For these function conio.h header file is to be included in the program.

void main()
 printf("Hello! C");

After compiling this program you will not to press Alt+F5 to see the result of the program. It will automatically pauses after showing result on the computer screen.

Editor for writing C Language program

For writing C Language program we use Turboc 3.0 editor. If you have windows 64 bit, then you will have to install DOS Box software to run dos based turboc 3.0 editor. You will have to download and install DOS Box from the following link

Download Link for DOSBox0.74-win32-installer.exe

After installing Dos Box start it you will see a windows having Z: prompt, Write following command on it


And then change drive to C: using following command

C: Enter

To install Turbo C Editor download it from following link

Download Link for Turboc 3.0

and save it into a folder in C: drive. For example if you save it in a folder name “CLang” then write following command to install TURBOC 3.0 in C: Drive –

C:\>c:\CLang\TURBOC -d

and press Enter key, after some time it will install in a folder C:\TC

To start Turbo c Editor write following command


and press Enter key, then you will see the editor like

Turboc 3.0 editor first screen
Turboc 3.0 editor first screen

If you want to start Turbo C 3.0 directly through DOSBox 0.74 Shortcut from desktop, Then update DOSBox Options from start menu using following steps

Start Menu -> App Programs -> DOSBox-0.74 -> DOSBox 0.74 Options

Write following command in the option file


And save it and close.

Now when you click on DOSBox 0.74 shortcut the Turbo C 3.0 Editor will start. You can use alt+enter to make full screen

Use following shortcuts to use Turbo C 3.0 Editor

To Close Current Window  Alt+F3 
To Open a New Window     Alt+F+N
To Save file             F2 (It will ask to save file name, 
                         type any name having 8 of less 
                         characters with ".c" extension)
To Open previous file    F3
To Compile .C file       Alt+F9
To Run                   Ctrl+F9

Now write the program and enjoy.

Q1. How to input any two numbers and to print Sum of them?

void main() 
  int a,b,c;
  printf("Enter first no: ");
  printf("Enter second no: ");
  printf("Sum = %d",c);

In this program a,b and c are three integer type variables. Which are declared using int keyword. We will study about int keyword in Data Type section. The clrscr() function will clear the screen during runtime. To use this function we have to include header file conio.h using “#include<conio.h>” statement. The printf(“Enter first no: “) statement is used to show message “Enter first no: ”  and scanf() function is used to input value into a variable a. We have to use & operator before it because scanf() function returns value passing by reference of variable. Next printf(“Enter second no: “) statement is used to show “Enter second no: ” message on the screen at runtime. Then other scanf(“%d”,&b) is used to input value from keyboard into variable b. Next line c=a+b is used to make sum of a, b variables into variable c. The next printf(“Sum = %d”,c) is used to show result. If the inputs are 5 and 7 then output will like “Sum = 12”. The getch() functon will pause the result screen. You can press any key to return from there.

Escape Sequences

\n    New Line
\\    To print Slash (\)
\"    To print double quote (")
\a    Beep sound
\b    Back space (Amit\b\b\bj will show Ajit, here three \b will move back the cursor and j will overwrite m)
\r    Carriage return    (Used in Ubuntu or ANSI C)
\l     Line Feed              (Used in Ubuntu or ANSI C)
\v    Vertical Tab          (Used in Ubuntu or ANSI C)



Leave a Reply

Your email address will not be published.