26-02-2011, 09:52 AM
[attachment=9142]
C – Programming
History of programming languages
In the 1950s, the first three modern programming languages whose descendants are still in widespread use today were designed:
FORTRAN (1955), the "FORmula TRANslator", invented by John Backus
LISP, the "LISt Processor", invented by John McCarthy
COBOL, the COmmon Business Oriented Language, created by the Short Range Committee, heavily influenced by Grace Hopper.
Another milestone in the late 1950s was the publication, by a committee of American and European computer scientists, of "a new language for algorithms"; the ALGOL 60 Report (the "ALGOrithmic Language"). This report consolidated many ideas circulating at the time and featured two key language innovations:
Nested block structure : code sequences and associated declarations could be grouped into blocks without having to be turned into separate, explicitly named procedures;
Lexical scoping : a block could have its own private variables, procedures and functions, invisible to code outside that block, i.e. information hiding.
Some important languages that were developed after this period include:
1968 - Logo
1970 - Pascal
1970 - Forth
1972 - C
1972 - Smalltalk
1972 - Prolog
1973 - ML
1975 - Scheme
1978 - SQL
C-Language Introduction
C is a general-purpose computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system
Although C was designed for implementing system software it is also widely used for developing portable application software.
C is one of the most popular programming languages and there are very few computer architectures for which a C compiler does not exist. C has greatly influenced many other popular programming languages, most notably C++ which began as an extension to C.
C has been already superceded by other languages like C++, C#,VB, java,etc. so why bother to learn C today? There are several reasons like this,
(a) Nobody can learn C++ or Java without understanding things like classes, objects, inheritance, polymorphism,templates,exception handling, etc.
(b) Many languages like C++ and Java can make use of a principal called object oriented programming tools and frameworks but using these frameworks and tools you would be still required to use the core C language elements.
© Major parts of popular operating systems like Windows, UNIX, Linux as still written in C. so even today when it comes to performance nothing beats C.
(d) Mobile devices like cellular phones, palmtops with consumer devices like washing machines, microwave, digital cameras are having microprocessors, an operating system and a program embedded in these devices.
Steps in learning C
C constants, variables and keywords :
The alphabets, numbers and symbols when properly combined form constants, variables and keywords.
Constant is a entity that never change and the variable is a entity that may change.
C Constant
Integer constant
(a) An Integer constant must have atleast 1 digit.
(b) It must not have a decimal point.
© It can be either positive or negative.
(d) If no sigh proceeds an integer constant, it is assumed to be positive.
(e) No commas or blanks are allowed.
(f) The allowable range for integer constant is -32768 to 32768.
It can also state that the range of an integer constant depends upon the compiler. The above range is for 16 bit. For 32 bit compiler the range would be even greater.
Real constant
(a) A real constant should have atleast 1 digit.
(b) It must have a decimal point.
© It could be either positive or negative.
(d) Default sign is positive.
(e) No commas or blanks are allowed within a real constant.
The exponential form of representation of a real constant is either too small or too large.
Character constant
(a) A character constant is a single alphabet, a single digit or a single special symbol enclosed within a single inverted comma. Both the inverted commas should point to the left.
(b) The maximum length of a character constant can be 1 character.
Character constant have integer values that are determined by the computers particular character set. Thus the value of a character constant may vary from one computer to another. The constant themselves, however, are independent of the character set. This feature eliminates the dependence of a C Program on any particular character set.
Most computers and virtually all personal computers make use of ASCII character set, in which each individual character is numerically encoded with its own unique7-bit combination.
C Keywords :
Keywords are the words whose meanings has already been explained to the c compilers. The keywords can not be used as variable names because if we do so, we are trying to assign a new meaning to the keyword, which is not allowed by the computer. Some c compilers allow to construct variable names that exactly resemble the keyword. There are only 32 keywords available in C. some compilers may recognize other keywords. The all keywords are all lowercase. Since uppercase and lowercase characters are not equivalent , it is possible to utilize an uppercase keyword as an identifier. Normally, however, this is not done, as it is considered a poor programming practice.
First C program
By knowing all the concepts about the variable, keywords and constants the next logical step is to combine them to form the instructions.
Before starting to proceed with the program we all must remember the rules applicable to the all C programs.
(a) Each instruction in the C program is written as a separate statement. Therefore, a complete C program would comprise a series of statements.
(b) The statement of a program must appear in the same order in which we wish them to be executed, unless of course the logic of problem demands a deliberate ‘jump’or transfer of control to a statement, which is out of sequence.
© Blank spaces may be inserted between two words to improve the readability of the statement. However, no blank spaces are allowed within a variable, constant or keyword.
(d) All statements are entered in small case letters.
(e) C has no specific rules for the position at which a statement is to be written. That’s why it is often called free from language.
Every C statement must end with semicolon (. Thus ( acts as a statement terminator
C – Programming
History of programming languages
In the 1950s, the first three modern programming languages whose descendants are still in widespread use today were designed:
FORTRAN (1955), the "FORmula TRANslator", invented by John Backus
LISP, the "LISt Processor", invented by John McCarthy
COBOL, the COmmon Business Oriented Language, created by the Short Range Committee, heavily influenced by Grace Hopper.
Another milestone in the late 1950s was the publication, by a committee of American and European computer scientists, of "a new language for algorithms"; the ALGOL 60 Report (the "ALGOrithmic Language"). This report consolidated many ideas circulating at the time and featured two key language innovations:
Nested block structure : code sequences and associated declarations could be grouped into blocks without having to be turned into separate, explicitly named procedures;
Lexical scoping : a block could have its own private variables, procedures and functions, invisible to code outside that block, i.e. information hiding.
Some important languages that were developed after this period include:
1968 - Logo
1970 - Pascal
1970 - Forth
1972 - C
1972 - Smalltalk
1972 - Prolog
1973 - ML
1975 - Scheme
1978 - SQL
C-Language Introduction
C is a general-purpose computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system
Although C was designed for implementing system software it is also widely used for developing portable application software.
C is one of the most popular programming languages and there are very few computer architectures for which a C compiler does not exist. C has greatly influenced many other popular programming languages, most notably C++ which began as an extension to C.
C has been already superceded by other languages like C++, C#,VB, java,etc. so why bother to learn C today? There are several reasons like this,
(a) Nobody can learn C++ or Java without understanding things like classes, objects, inheritance, polymorphism,templates,exception handling, etc.
(b) Many languages like C++ and Java can make use of a principal called object oriented programming tools and frameworks but using these frameworks and tools you would be still required to use the core C language elements.
© Major parts of popular operating systems like Windows, UNIX, Linux as still written in C. so even today when it comes to performance nothing beats C.
(d) Mobile devices like cellular phones, palmtops with consumer devices like washing machines, microwave, digital cameras are having microprocessors, an operating system and a program embedded in these devices.
Steps in learning C
C constants, variables and keywords :
The alphabets, numbers and symbols when properly combined form constants, variables and keywords.
Constant is a entity that never change and the variable is a entity that may change.
C Constant
Integer constant
(a) An Integer constant must have atleast 1 digit.
(b) It must not have a decimal point.
© It can be either positive or negative.
(d) If no sigh proceeds an integer constant, it is assumed to be positive.
(e) No commas or blanks are allowed.
(f) The allowable range for integer constant is -32768 to 32768.
It can also state that the range of an integer constant depends upon the compiler. The above range is for 16 bit. For 32 bit compiler the range would be even greater.
Real constant
(a) A real constant should have atleast 1 digit.
(b) It must have a decimal point.
© It could be either positive or negative.
(d) Default sign is positive.
(e) No commas or blanks are allowed within a real constant.
The exponential form of representation of a real constant is either too small or too large.
Character constant
(a) A character constant is a single alphabet, a single digit or a single special symbol enclosed within a single inverted comma. Both the inverted commas should point to the left.
(b) The maximum length of a character constant can be 1 character.
Character constant have integer values that are determined by the computers particular character set. Thus the value of a character constant may vary from one computer to another. The constant themselves, however, are independent of the character set. This feature eliminates the dependence of a C Program on any particular character set.
Most computers and virtually all personal computers make use of ASCII character set, in which each individual character is numerically encoded with its own unique7-bit combination.
C Keywords :
Keywords are the words whose meanings has already been explained to the c compilers. The keywords can not be used as variable names because if we do so, we are trying to assign a new meaning to the keyword, which is not allowed by the computer. Some c compilers allow to construct variable names that exactly resemble the keyword. There are only 32 keywords available in C. some compilers may recognize other keywords. The all keywords are all lowercase. Since uppercase and lowercase characters are not equivalent , it is possible to utilize an uppercase keyword as an identifier. Normally, however, this is not done, as it is considered a poor programming practice.
First C program
By knowing all the concepts about the variable, keywords and constants the next logical step is to combine them to form the instructions.
Before starting to proceed with the program we all must remember the rules applicable to the all C programs.
(a) Each instruction in the C program is written as a separate statement. Therefore, a complete C program would comprise a series of statements.
(b) The statement of a program must appear in the same order in which we wish them to be executed, unless of course the logic of problem demands a deliberate ‘jump’or transfer of control to a statement, which is out of sequence.
© Blank spaces may be inserted between two words to improve the readability of the statement. However, no blank spaces are allowed within a variable, constant or keyword.
(d) All statements are entered in small case letters.
(e) C has no specific rules for the position at which a statement is to be written. That’s why it is often called free from language.
Every C statement must end with semicolon (. Thus ( acts as a statement terminator