Saturday, 1 August 2015

Learn C language-Tutorial 1: How to run a C program

By
  Narendiranath


Hai, this tutorial will teach you how to run a c  program, although you don’t have much knowledge about it.
Let me something tell about C. C  program is a high level language developed by Dennis Ritchie in the year 1972.
Developed at AT&T bell laboratory



The C program is written in high level language and it cannot be directly understand by the system, so a compiler(converts high level language to machine level language) is needed.
I prefer Turbo c++ compiler in which we can compile both c and c++ programs.

Let we start our coding…..
In order to program we need a compiler so download Turbo c++ software
download-turbo-c
click-link
Click the Download
click-download
If you have Internet Download Manager click Start Download otherwise it will be normally downloaded in the web browser.
start-download
Then Install the Turbo c++
double-click
turboc
I-agree
Click The Install
Install
Then Installing will be started
Installing
Finish
After the installation completed the Turbo c++ compiler will be opened with a pre-defined graphic program.
[Note: press ALT+Enter to make the compiler minimize and maximize.]
Compiler
Then go to FILE click new
new
So after the new screen is opened save it as filename.c
save-as
For example demo.c and click OK
save-as
SO type the following simple C program to print “This is my first c program” in the output screen
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf(“this is my first c program”);
getch();
}
c-program
After typing the program save it again,  we have to compile the program, to compile click the Compile option or you can use the short cut key  Alt+F9
compile
Then it checks for any error and it will display the number of errors and warnings. If the program is right it will show the error and warnings as 0.
compiled
Then it is time to run the program and get the output.
Run
Then the output will be displayed
output
Yahooooooooooo……..
we have successfully got the output.
Thus the simple program in C is implemented successfully.

SOME BASIC TIPS FOR C PROGRAMMING


  1.  Each instructions in a c program is written as a separate statement.Therefore, a complete C program would comprise a series of statements.
  2. The statements in a program must appear in the same order in which we wish them to be executed. 
  3. Blank statement may be inserted to improve the readability of the statement, but no blank spaces are allowed between variables.
  4. All statements are written in small letters.
  5. C has no specific rules for the position at which a statement is to be written, that's why it is also called as free-form language.
  6. Every statement must end with a ' ; ' , the semi-colon is used as statement terminator.    
In the upcoming tutorials I will teach C more specifically…