Overview of C Programming Language | Study of computer science

INTRODUCTION OF  C  LANGUAGE


C programing language is one of the most popular computer languages today because it is a structured, high-level, machine-independent language. It allows software developers to develop programs without worrying about the hardware platform where they will be implemented.

HISTORY OF  C




study of computer science overview of c programming language, study of computer science, c language, coding languages, web programming languag, list of programming languag, most popular programmin, c programming book, embedded c programming, latest programming languag, how to learn c language
HISTORY OF  C LANGUAGE

The main part of all modern language is ALGO, introduced in the early in the 1960s. ALGO was the first computer language to use a block structure. It was very popular in EUROPE. ALGO gave the concept of structured programming to computer science. Many computer scientists popularize this concept during the 1960s. 


MARTIN RICHARDS developed a language called BCPL (Basic Combined Programming language) in 1970 primarily for writing system software. By using the many features of BCPL, a scientist THOMPSON created a language called simply B. B was used to the created early version of the UNIX operating system at Bell Laboratories.
BCPL and B were "types less" system programming language.

 After using many concepts of ALGOLBCPL, B language the C language evolved by DENNIS RITCHIE in 1972 and add the concept of datatypes and other powerful features.so, it is strongly associated with the UNIX operating system. UNIX is one of the most popular networks operating system is used today and the heart of the Internet data superhighway.

During the 1990s, C++  language was developed completely based on c language. In c++ added several new features to c to make a more versatile language. In the USA a new language developed by SUN MICROSYSTEM called Java evolved form c and c++.  


IMPORTANT OF C  LANGUAGE                                                             
Study of computer science overview of c programming language, study of computer science, c language, coding languages, web programming languag, list of programming languag, most popular programmin, c programming book, embedded c programming, latest programming languag, how to learn c language
IMPORTANCE OF C LANGUAGE 
1. It is a robust language whose rich set of built-in function and operators can be used to write any complex program. The C compiler combines the capabilities of an assembly language with features of a high-level language and therefore it is well suited for writing both system software and business packages.                 
 2. Programs are written in C are efficient and very fast than BASIC.  This is due to its variety of data types and powerful operator.

3. C program written in one computer can be run in any other computer by little or no modification.so, C is highly portable. 

4. Important features of C is its ability to extend itself. A C program is basically a collection of functions that are supported by the C library.

   

SIMPLE PROGRAM 1: PRINTING A TEXT

         main()
         {
           /*...........printing begins...........*/
            printf("i see you");
            /*..........printing ends..............*/
             }

On the above, we do just code a simple program to print one line text. This program when executed will produce i see you.
Now focus on the program written above. The first line informs the system that the name of the program is main and execution being at this line. The main() is a special function of C programming to tell the system where the program starts. Every program exactly one main function. If we use more than one main function than compiler confused to which one mark beginning of the program. 

The opening brace "{"  in the second line denotes the beginning of the main function and closing brace "}" in the last line indicating the end of the function. All statement inside the braces is called the function body. The function body contains set information to perform the given task.

Inside the function body, contain three statements out of which only the printf line is an executable statement. The line begins with /*  and end with */ are know as comment lines. It is not an executable statement so anything between them ignored by the compiler.

If you want to print the two text in two different lines like 
                           i see you,
                           i like you.
then you have to do these things
printf("i see you,\n");
printf("i like you.);
The information contains between the parentheses is called the argument of the function. This argument of the first printf is "i see you,\n" and second is "i like you." These arguments are simply strings of characters to be print out. The argument of printf contains a combination of two character \ and n at the end of the string. This combination called the newline character. A newline character instructs the computer to go to the next line.so, "i like you" print in a new line. No space is allowed between \ and n.

NOTE:C does make a distinction between uppercase and lowercase latter like printf and PRINTF are not the same. 


THE main FUNCTIONS

The main is a part of every C program. C permits different forms of main statement likes

  • main( )
  • int main( )
  • void main( )
  • main(void)
  • void main(void)
  • int main(void) 
The empty is a pair of parentheses indicate that the function has no arguments. This may be also indicated by using the keyword void. Keyword, void also use before the main function it means that function does not return any information to the system and keyword int before the main function it means that function returns an integer value to the operating system. Keyword also between the parentheses means that function has an argument in integer datatype. 


WHAT IS THE USE OF VARIABLE AND HOW TO DECLARE IN THE PROGRAM


The variable name that is used to store any datatype it may be the integer(declare as int), character(declare as char), real number(declare as float) etc. In C, all variable should be declared to tell the compiler what is variable name is and type of data that they hold. The variables must be declared before they are used like
                                      int number;
                                      float amount;

NOTE: Space is not allowed between the variable name and semicolon must be at the end.

Keyword int before the number variable name it means that number store integer datatypes. Similarly, float before the variable name amount it means that amount store fraction no. datatypes.


LITTLE MORE USE OF printf  IN PROGRAM

If we want to print the integer no. which store in number variable name then write the program in  the following way
                          printf("%d\n",number); .
Now when we execute the program then no. is print out on screen which store in number variable name.
The first argument "%d" tell the compiler that the value of the second argument number must be an integer.
Similarly, if we want to print fraction no. which is stored in the amount variable name then write the ram like 
                          printf("%f",amount");
Here we get fraction value on screen.
This format tells the compiler to print fraction which is store in amount variable name.


THE  #INCLUDE  DIRECTIVE

C programs are divided into two modules. Some functions are written by the user and some other stored in c library. Library functions are grouped and stored in different files known as the header file. If we want to use the function stored in the library. It is necessary to tell the compiler about the file. This is achieved by using the preprocessor directive #include as follows.
                          #include<filename>
filename contain the require function.


USE OF MATHEMATICS FUNCTION


We often use mathematic functions such as cos, sin, exp etc. The stander mathematics functions are defined and kept as part of the C math library. If we want to use any of mathematical function then we must have to add an #include instruction in the program. It is a compiler directive that instructs the compiler to link the specified mathematical function from the library. The instruction is of the form
                          #include<math.h>
math.h is filename containing the require all function.It must take above all functions.


PROGRAMMING STYLE

C is a free-form language. C  compiler does not care, where on the line we being typing. Although several alternative styles are possible, we should select one style.

We must develop a habit to write in lowercase during programming. C program statements are written in lowercase. Uppercase use only for the symbolic constant.

Braces are used to indicate the beginning and the end of programs.

we can also insert comment line to describe what you want to do in this program which I describe early with an example.


EXECUTING A 'C' PROGRAM

Executing a program written in C involves a series of steps like
  • Creating the program,
  • Compiler the program,
  • Linking the program with functions that are needed form the C library,
  • Executing the program.
The process of creating, compiling and executing a C program. Although these steps remain the same irrespective of the operating system, system commands for implementing the steps and convention for naming file may differ on different systems.






                       

Comments