Overview

The "C" language is one of a huge number of programming languages currently in use, and one of the oldest. It was created in the early seventies of the twentieth century by Dennis Ritchie while he was working in Bell Laboratories. Some say that "C" was a by-product of a project which led to the very first version of the Unix operating system. There are many other programming languages widely used " some of them could be regarded as "C" descendants. They even inherited a name from their ancestor like "C++" or "C ". Others borrowed some features from the original "C" and added lots of new ones like Perl, Java or JavaScript.

Learning C, no doubt is an added advantage to the career of any IT professional but it is tough indeed.Following few challenges are mentioned which a novice in this C environment may face :

Objective:

Objective is to cope up with all the above mentioned challenges.It is composed to cover the following topics with easy, relevant to the topics, and small but most effective illustrations :

All the features of C Programming are discussed in this part with ready to use programs.Here, the whole discussion is distributed over 12 chapters.

Create Compile Run Program:

1.How to edit this Program:

C programCan be written with any text editor. In Windows, we can use Notepad or NotePad++, in Linux gedit or vi can be used. Save this file having name FirstProgram.c. The name of the C source file is arbitrary. It must be suitable name so that you may find out What this program describes and extension must be c.

gedit FirstProgram.c

2.How to compile this Program:

The gcc compiler converts the c programs into byte codes.For Linux users, you will need to first save the program and open terminal make sure that you are in the directory you are using to store your c program, then enter the following command :

gcc -o FirstPgm FirstProgram.c or
gcc FirstProgram.c

After the successful compilation, byte codes will be produced which will be automatically stored in the same directory but with file name having extension .exe ( e.g. here the class file name will be FirstPgm.exe).

3.How to run the C Program:

To run the Program, you have to type the command ./FirstPgm( from the terminal ).

For example, our First Program can be run as: ./FirstPgm or ./a.out With this the C compiler will be invoked and it executes the byte code stored in FirstPgm.exe file.The output then will appear onto the screen.

4.Basic structure of any Application:

An Program must contain at least one the main function. It may contain more than one function also.

First C Programming-Print on Screen

Consider the following few codes as the first C Program for you :

      Illustration  2.1			//      First C Program      //
        #include<stdio.h>
        int main()
        {
          printf("Hello,It's my first program.");
          return 0;
        }
      

These lines comprise the minimum components necessary to print Hello,It's my first program. onto the screen.

        Illustration 2.2
          #include<stdio.h>
          void main()
          {
              printf ("Hello, World! \n") ;
              printf ("Hello \n World! \n") ;
              printf ("Hi\nHello \t World! \n") ;
          }
    
        OUTPUT:
          Hello, World!
          Hello
          World
          Hi
          Hello	World!
        
Home Page
Top of Page
Go Next
Go Next