Você está na página 1de 4

INTRODUCTION TO COMPUTER SCIENCE

MOHSIN VIQA SP12-BS-0021 4-APRIL-2012

C LANGUAGE
C Language programming language that was developed in 1972 at AT and Ts Bell laboratories of USA. Dennis Ritchie is known as the designer and the writer if C language .Soon after development C language, C language replaced traditional programming languages of that time like FORTRAN,PL/I and ALGOL. The success story of C Language continued and today , almost each and every computer professional starts the programming basics using C language. C language served the base for creation of many other programming languages like C++. That is the only reason, C language is known as mother language. C language allows a programmer to create program that work with a close interaction to hardware, that is why C language is known as System Programming language. C equally important in writing major numerical, text and database processing applications. It was originally written to develop programs on UNIX operating system and later it was rewritten for MS DOS operating system. C is also known as middle level language. Before the origin of C language, programmers were using machine-oriented languages or low level languages , in which they worked with actual binary codes to program the activities of computer. Binary codes were very difficult to learn and implement. C language belongs to the category of programming languages , called as high level languages. These languages have been designed to provide a better programming efficiency by providing faster program development. C successfully combine the structure of a High Level Language and the power and efficiency of Assembly Language or low level language. We use compilers to translate a program written in C language and no one can be designed as a started compiler.

Features of C Language
C Language has a rich set of features due to which , it remained the first choice of programmers for a long time. These features of C language make it very powerful language that offers ease of programming like high level languages and power of low level languages. Following are the main features of C language:

1)

C has a relatively easier syntax than FORTRAN, COBOL and PASCAL.

2) C is an efficient and fast programming language. It is more than 50 times faster than BASIC.

3) C language has 32 most commonly used keywords . In addition 8 are used with system programming. 4) C language contains vast set of data types as compared to languages of its times.

5) C language is highly portable language. This means, if you have created a program in one computer, it will run on the other computer without any modifications. 6) C is a very well suited language for structured programming. The programmers can easily divide a problem into muddles of functions. 7) 8) 9) C has got rich set of library functions. The functions readymade functionality to the users. C also has a support for Graphics programming. C can efficiently deal with bit, byte and word addresses.

C Keywords
Every Word in a program of C will be keyword or an identifier. Every language has a set of characters, whose meaning is already defined and known to the compiler. The members of this set are reversed words that can be used ina predefined way. These are called keywords. The variables names defined in the program cannot be form the set of keywords. C compiler has 40 keywords. The list of these keywords is given as follows:-

Auto , break , case , char , const , continue , default , do , double , else , enum ,extern , float , far , for , goto , if , int , long , near , register , return , short , signed , Static , struct , switch , typedef , union , unsigned , void , while
In addition to these 32 keywords, 8 special keywords are also used low level programming.

Note:- C has 32 general purpose and 8 special purpose keywords.


Indentifiers are the names given to variables , functions , structures and arrays . They are called so as they identify a particular part of the program . Identifiers are made up of characters and digits . you can use both uppercase and lowercase characters with any combination of digits. The name of the identifier always starts from a character. Rules For Declaring Identifiers:Following are the rules for declaring identifiers. 1) 2) 3) The first character of an identifier must be an alphabet or underscore. It can have letters , digits and valid special characters. C will take only first 31 characters of the identifier.

4) 5)

Identifier cannot be a keyword. You cannot use a white space in a indentifier.

Data type
Data type represents type of input to be carried in the variable. We generally encounter so many types of values in our daily working routine i.e. employee number , salary , employee name , project or department name etc . For different types of values , we have different data types . For example roll number should be a whole number and it cant be in fractions or with decimals but the salary can be in decimals similarly name should be of several characters values while grade should be of single character like A , B or C . The need of datatypes can be understood from a simple example . Suppose you go to market to buy 5 kg wheat flour . If the shopkeeper gives you flour in a paper bag , there will be no problem in carrying . But , if you need 2 liters of milk , then paper bag would not be suitable to carry milk . It definitely needs a polybag. Similarly , different types of data items of data items need different types of data types to handle them .

Note:- Datatypes represents type of input to be carried in the variables.


Datatypes can be classified into primary or fundamental data types , derived data types and users defined data types. Pointers and void data types are the other supported data types by c language. 1) Primary Data Types:-

Four fundamental data types are supported by all C compilers. These are: 1. Integer 2. Character 3. Float 4. Double precision float

Many of the compilers also support extended data types like long int and long double. Each data type has its own range that specifies the range of values , it can handle . Integer Data Range:-

Datatype Int Unsigned int Short int Insigned short int Long int Unsigned long int

Range Bytes -32768 to +32768 2 0 to 65535 2 -128 to 127 1 0 to 255 4 -2, 147 , 483 , 648 to 2 , 147 , 483 , 6474. 0 to 4 , 294 , 967 , 295 4

Você também pode gostar