Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
A in 1972.It was designed AT&T:- American Telephones and Telecommunication C seems to be popular because it is reliable, simple and easy to use.C contains 90%Unix and 10% assembly languages.
Therefore an international committee was setup to develop a language called ALGOL 60. This language seemed to be abstract and too general.To reduce this abstractness and generality a new language called CPL (combined programming language) was developed at Cambridge University.CPL was having so many features that is was hard to learn and difficult to implement.
BCPL- Basic combined programming language developed by MARTIN RICHARDS at Cambridge University armed to solve this problem of CPL.But unfortunate it turned to be less powerful and specific.At around the same time a language called B was written by KenThompson at AT&Ts Bell lab as further simplification of CPL.Ritchie inherited the features of B and BCPL added some of his own and developed C
1960
ALGOL
International committee
1963
CPL
Cambridge hard to learn, University difficult to imple Martin Richards could deal only at Cambridge with specific problems Ken Thomsen at could deal only with AT&TS specific problems Dennis Ritchie lose generality of at AT&TS BCPL and B restored
Where c stands
All programming languages can be devided into two categories. 1) Program oriented language or high level language These languages are designed to give a better programming efficiency ie,faster program development .Eg:Fortran,Basic,Pascal etc. 2)Machine Oriented or low level language:These languages have been designed to give a beetles machine ie.faster program execution. eg :assembly language or machine language.
C stands in between two categories so it is known as middle language as it is both relatively good programming and a relatively good machine language. Steps in learning C
Alphabets,digits, special characters Constants,variabl es,keywords
Instructions
Program
Alphabets A to Z a to z Digits-0 to 9 Special characters- ~ ! @ # $ % ^ & * etc.. White space-Blank spaces,horizontal, carriage return,new line,form feed. C Tokens:- In a passage of text individual words and punctuation marks are called tokens. In C program smallest individual units are known as C tokens.
C has six types of tokens 1.Key words 2.Identifiers 3.Constants 4.Strings 5.Special symbols 6.Operators
Key words and identifiers:Every C word is classified as either a key word or as identifiers. All key keywords should be written in lower case. The meaning of the words has already been given to C compiler and also is known as reserve words. They cannot be used as variable names. Ex: case,, break,if, for,,goto,etc..
Identifiers: Refers to the names of variables ,functions and array.These are user defined names and consists of sequence of letters and digits with a letter at the starting.Both upper case and lower case are permitted. Constants: A constant in C refers to a fixed value that do not change during the execution of a program.Thus constant is stored at particular location in the memory of the computer.
Constants
Numeric
Character
Integer constant
Real constant
Single character
String constant
Variable: A variable is a name that may be used to store a data value in the memory. Rules for constructing a C variable 1. A variable should be 1 to 8 characters or combination of alphabets , digits and underscores in length 2.The first character in a variable should be in an alphabet. 3.No commas or blanks are allowed in a variable name 4.No special symbol other than underscores are allowed Syntax for declaring a C variable data type <variable_name>;
Advantage of C: 1.C consists of declarations,expressions and function. 2.C is a language is used write viewers and activities program. 3.C is a case sensitive ie.it should be written in lower case.
4.C is a structure language ie.it follows as certain set of rules. 5.Modular Approach: .it break into big modules into smaller modules by means of using functions 6. C follows top down approach. 7.C is a low level language where the coding is near to the assembly language.
8.C is also known as middle level language and 50% of the coding is in low level language 9.C has no specific rules for the position at which the statements is to be written ie. Why it is freeform language. 10.Every C statement ends with ;
Data Types
Ansi C supports 4 classes of data types 1.Primary or fundamental data types 2.User defined data types 3.Derived data types 4.Empty dataset
All C compilers supports 4 fundamental data types Data type meaning size(bytes) range of values Char a character 1 -128 to 127 Int an integer 2 -32768 to 32768 Float a single 4 3.4e-38 to 3.4e+38 precession real no. Double a double precession real no. Void valueless
1.7e-308 to 1.7e+308
Sometimes we come across situations where the constant is small enough to be an int, but still we want to give it as much storage as a long. In such cases we add a suffix L or l at the end of the number. 23 an integer occupies 2 bytes where as 23 L a long integer occupies 4 bytes
Integer Signed and Unsigned When a value is declared it by default takes as +ve value.When we declare the variable to be unsigned the size of the range which is from 32768 to 32767 shifts to 0-65535. It almost double the size.This so happens because as declaring the integer as unsigned the 16th bit is now free and is not used to store the sign of the number.An unsigned integer still occupies 2 bytes.An unsigned int is nothing but a short unsigned int
Short unsigned int i; Unsigned int i; Unsigned i; Are all same. Long unsigned int:-has a range of 0 to 4294967295 and occupies 4 bytes of memory space.By default a short int is a signed short int and a long int is signed long int Chars signed and unsigned Signed char same as char and has a range from 128 to 127 Unsigned char has a range from 0 to 255