Академический Документы
Профессиональный Документы
Культура Документы
Brief History
Brief History of C Programming Language C is a general-purpose
language which has been closely associated with the UNIX
operating system for which It was developed - since the system
and most of the programs that run it are written in C.
2. Microcomputer
1970
3. American National Standard Institute
1983
4. 1989 Programming Language C
1988 5. ANSI or Standard C or C89
TIME PERSONALITIES/THEORIES/
TECHNOLOGICAL INNOVATIONS
FRAME
8. ISO/IEC 9899, 1999 or C99
1999 9. ANSI TURBO C
The Standard
1. The early informal standard (in 70’s) was the UNIX SYSTEM V
(as described in “The C Programming Language” by B.
Kermighan & Dennis Ritchie)
2. There were large numbers of C version because of the
growing popularity of microcomputer and the source code
accepted by most of these version is highly compatible.
3. There were no standard resulting to dicrepancies.
4. To rectify the prod. ANSI beginning in 1893. established
standard specific of C and ratified as ANSI X3.159 1989
Programming language C and is often referred to ANSI C,
Standard C or C89.
5. In 1903, the 'Marmite organ for standardize (ISO) adopted
the ANSI C Stand (with formatting changes) as ISO!IEC
9899.1990 or sometimes called C90. C89. and CO refer to the
same language.
6. The last ANSIIISO standardize was ISOIIEC 9899:1999 or
known as C99.
7. 7. ANSI Turbo C is a fart efficient compile/ and provides
both an Integrated programming environment and the more
traditional command-line version to satisfy the wide
variety of programming.
Middle Level
1. C – A mid level computer language. It combines the elements of high level
language with the functionalism of low level assembly language. It allows
the manipulating of bits, bytes and addresses the basic elements with
which the computer functions.
2. C code is very portable, means that is possible to adapt software written
for 1 type of computer to another. barn*. A program written for Apple II
can be moved easily to an IBM PC.
3. All high level programming language support the concept of Date type.
Data type defines a set of values that a variable can store along with a
set of operations that can be performed an the variable. Example. Common
data types are integers, characters, and real numbers,
4. C has five basic built in data types but is not a strongly typed language
like Pascal or Ada
5. C will allow almost all type conversions Example. Character and integer
types may be freely inter mixed in most expressions. G.
6. Traditionally C performs no run time checking such as array boundary
checking or argument type compatibility checking. These checks are
responsibility of the programmer.
7. Special feature of C7 allows the direct manipulation of bits, bytes,
words and pointers which suits system level programming. a_ C has only 32
keywords (27 from the Kermighan and Ritchie Standard and 5 added by the
ANSI standardize). (Turbo C contains II more keywords, BASIC For the IBM
PC contains 159 keywords.)
Structured Lang.
1. C is not strictly called book-structured language.
2. C Is commonly called a structured language because of structural
similarities to ALGOL, Pascal and modula 2. (Technically, a block
structure language permits procedures or functions to be declared
inside other procedure or functions. In this way the concept of "global
and "lot" are expanded through the use of scope rules which govern the
'visibility" of a variable or procedure.)
3. C does not allow the creation of functions within functions, it is not
really block structured.
4. The distinguished feature of a structure language is
compartmentalization of code and date. Compartmentalization, the
language's ability to section off and hide from the rest of the
program. All information and instruction necessary to perform a
specific tick
4.1. Subroutines, one way to achieve compartmentalization by employing
local C temporary variable so that the events that occur within them cause
no side effects in other parts of the program, making It very easy for the
C program to share sections of code.
4.2. In compartmentalized function you only need to know what a function
does, riot how it does it
Structured Lang.
4.3. Remember that excessive use of global variables (variables known
throughout the entire program) may allow bugs lo creep into a program by
allowing unwanted side effects. (Anyone who has programmed in BASIC is
well aware of this problem).
5. A structured language allows a variety of program possibilities by
widely supporting loop constructs, such as while, do while, and for. and
prohibits the use of goto (moo Is not tits tons of program control as It
Is in BASIC and FORTRAIN).
6. A structures language allows you to indent statements and does not
allow a strict field concept.
EXAMPLE OF STRUCTURED AND NON STRUCTURED — Pascal, Ada, C
NON STRUCTURED - FORTRAN, BASIC, COBOL
C's place in the world of language:
HIGHEST LEVEL: MIDDLE LEVEL:
Ada C
Modula-2 FORTH
COBOL Macro-assemble language
FORTRAN LOWEST LEVEL:
BASIC Assembly language
Standard Lang.
7. Structured language is newer, non structured language are older. The
clarity of structured language makes program and maintenance easier than
non structured language.
8. C’s, stand alone subroutine, the main structural component of C.
Function — the building block in which all program activity occurs, they
allow the separate task in a program to be defined and coded separately,
thus allowing your program to be modular. After a function has been
created, it should work properly in various situation without creating side
effects in other parts of the program stand alone function is critical in
larger projects.
9. Code block, another way to structure and compartmentalized code in C. a
logically connected group of program statements that is treated as a unit.
It is created by placing a sequence between opening and closing braces.
Example of a code block. If (x < 10) Print f ("too low, try again");
reset_counter (-1); Analysis: the two statement after the if and between
are both created if x is less than 10. The "f", the two statements and "y
form the code block. One of the statement execute without the other. Code
block allow many algorithms to be implemented with clarity, elegance and
efficiency and helps the programmer to conceptualize the true nature of the
routine.
Programmer Lang.
1. C is a programmer's language.
2. Not all programming language are for programmers. Example. COBOL and
BASIS was designed to enable non-programmers to read and presumably
understand the program and to solve simple problems.
3. C stands almost alone. It was created, influenced and field tested by
real working programmers, resulting to few restrictions, few complaints,
block structure, stand alone functions and compact set of keyboards;
making it amazing that a programmer can achieve nearly the efficiency of
assembly code, combined with the structure of ALGOL or Module 2, resulting
to established C as the most popular among topflight professional
programmers – due to the fact that C can often be used in place of
assembly language.
4. Assembly language uses a symbolic representation of actual binary code
that a computer executes. Each assembly language operation maps into a
single task for the computer to perform.
16. All C keywords are lower case. Upper case and lowercase are different.
17. All C programs consist of one or more functions. The only function
that absolutely must be present is called main () – the first function
called when program execution begins. Outlines what the program does,
outline is composed of function calls, main () is technically not a part
of C language but treat it as if it were and don’t use as the name of the
variable.
18.The general form of C Language programming
Global Declarations
Main ()
{
Local variable
Statement sequence
}
F1 () f2 ()
{ {
Local variables local variables
Type Modifiers:
-basic data types may have various modifiers preceding them, used to alter
the meaning of the base type to fit the needs of various situation more
precisely.
Type Modifiers
Type Bit Range
Width
Character 8 0-255
Integer 16 -32788- 32767
Float 32 3.4-E38-
3.4+E38
Double 64 1.7E-308 –
Float 1.7E+308
Void - Valueless
Variables, Constants,
Operators and Expression
1. Variables and Constants are manipulated by operators to form expression
2.Identifier names, are used to reference variables, functions labels and
various other used defined objects are called identifiers, can vary from
1 – 32 characters, the 1st character must be a letter or an under score
“_”, bent characters being either letter, number of the underscore. Turbo
C allows $ to be used as an identifier name, but this is non-standard or
not recommended.
Correct Incorrect
Count 1count
Test23 Hi! There
High_there High..There
Variables, Constants,
Operators and Expression
3. In C, upper and lowercase are treated differently. Ex; Count, count, and
COUNT are 3 different identifiers.
4. An identifier cannot be the same as Turbo C keyword and should not have
the same name as functions that you wrote or that in the Turbo C library.
Variables, Constants,
Operators and Expression
Chapter 1
Introduction to Turbo C
An Introduction to programming using the Turbo C. programming Language
Starting Turbo C
This portion discusses the DOS as OS for running TB
20. The Main Menu Selections as displayed by the DOS.
The Turbo C Environment
20. The Main Menu Selections as displayed by the DOS.
Main Menu Selections - All operations of TC are selected
from the main menu. After an operation is completed, the
main menu is redisplayed to allow to choose another
operation.
printf(“this is”);
printf(“on &d line”,numa);