6:56 AM

C.

C is  a procedural  language developed by Dennis Ritchie in 1973.It was developed at Bell laboratories for the use in  Unix systems there.C is one of the widely used languages ever.It leads to the development of many OS's,languages etc.The played a major role in shaping the digital world as we see today.

Dennis Ritchie(standing)
http://www.cca.org/blog/images/dennis-ritchie.jpg

C Basics

Data types...In C the data the program is deals with can be any of the data types..character,integer,floating point or  double.The size allocation for each varies as 1,2,4,8 bits...
In c any variable must be declared before its use.A variable is nothing but a user defined name for a memory location which he can use to store data of any of the above data types.The declaration of a variable involves specifying the data type followed by its name.As..
int a;...declares a variable with name a which can hold an integer value.
Every statement in C ends with a semicolon.
Modularity in C . The C language enable the user to divide the entire program into different self independent module called functions.In fact the a c program begins execution from a function called main(). That is the main corresponds to the staring of the program.The program can also have user defined functions.
The C has got an inbuilt function named printf() which can be used to print an output on the standard output.The printf() function is defined in the library stdio.h ,that is the standard input output library.So the stdio.h should be added to your program to make the code execute,which can be written as
#include<stdio.h>
Now the printf is a formatted output function and can have a number of parameters.The simplest use of printf is to print some thing on the screen.This can be done by simply enclosing the text in double quotes .like...
printf("hello world");
The value of a variable can be printed using its control string ie %d for int %c for character etc.

The program code written in C is called the source code.The source code cannot be executed directly.The source code written in high level language has to be converted into binary code.This is done using the help of  another program called the compiler.So the compiler generates the corresponding binary code for the program which can be executed directly. The Linux operating system has a compiler collection which can do
the same it is called the GNU compiler collection or the gcc,The gcc take the source code as its argument and generates the corresponding binary code,which can be written as
gcc file_name
The compiler reports the presence of any syntactical errors if any.
 if not it creates an out put file with a .out extension
one can also specify the name of the output file in that case the above statement looks like
gcc -o output_file_name input_file_name
The gcc can also generate the assembly code of the same file for that  an extra argument -S with the above written as..
gcc -S file_name
it will create a file of the same name but of the extension .s
The so created output file can be executed from the terminal by simply giving in the pat of the file.If the present working directory of the terminal contains the  output   file it can be executed by thewritting
./output_file_name
.....................................................................................................................................................................


0 comments: