Sie sind auf Seite 1von 17

Programming Languages

Language Year Originator Purpose


J. Backus
FORTRAN 1954-57 Numerical
(IBM)
ALGOL 60 1958-60 Committee Numerical
Committee Business Data
COBOL 1959-60
Processing
APL 1956-60 K. Iverson Array Processing
J.
LISP 1956-62 Symbolic Computation
McCarthy
SNOBOL 1962-66 R. Griswold String processing
PL/I 1963-64 IBM General
SIMULA 67 1967 O. J. Dahl General
ALGOL 68 1963-68 Committee General
BLISS 1971 Wulf et. al. System Programming
PASCAL 1971 N .Wirth General and Education
Dennis
C 1974 System Programming
Ritchie
Xerox
MESA 1974 System Programming
PARC
P. Brinch Concurrent
CONCURRENT 1975
Programming
B. Liskov Abstraction
CLU 1974-77
Methodology
Committee Verifiable System
EUCLID 1977
Programs
Good et. al. Verifiable System
GYPSY 1977
Programs
PLZ 1977 Zilog inc. System Programming
MODULA 1977 N. Wirth System Programming
ADA 1979 J. Ichbiah General – Embedded
B. Object Oriented
C++ 1983
Stroustrup Programming
JAVA 1991 J. Gosling OOP + Embedded + N/W

-1- By: Kute T. B. for FYIF (2007-08)


Computer Languages

Imperative Declarative

Procedural Logical
e.g. C e.g. PROLOG

Object Based Functional


e.g. ADA e.g. LISP

Object Oriented Database


e.g. C++, JAVA e.g. SQL

Block Structured
e.g. PASCAL

-2- By: Kute T. B. for FYIF (2007-08)


FLOW CHART SYMBOLS

Start / Stop

General Processing

Decision

Input / Output

Connector

Function / Subroutine

-3- By: Kute T. B. for FYIF (2007-08)


Start

Input radius
in cm.

Calculate area =
3.14 * (radius * radius)

Display
area

Stop

-4- By: Kute T. B. for FYIF (2007-08)


Start

Accept five different


subjects’ marks i.e.
m1, m2, m3, m4, m5.

Calculate, per =
(m1+m2+m3+m4+m5) / 5

Yes
Display
per >=75 “Distinction”
No
Yes
Display
per >=60 “First Class”
No
Yes
Display “Second
per >=50 Class”
No
Yes
Display
per >=40 “Pass Class”
No
Display
“Fail”

Stop

-5- By: Kute T. B. for FYIF (2007-08)


Forming a C program

Alphabets, Program.
Digits,
Special
Symbols.

Constants,
Variables, Instructions
And
Keywords

-6- By: Kute T. B. for FYIF (2007-08)


C Constants.
• Primary Constants.
a. Integer Constants.
b. Real Constants.
c. Character Constants.
• Secondary Constants.
a. Array.
b. Pointer.
c. Structures and Unions.
d. Enum.

• Integer Constants.
e.g. 426
+756
-588 etc.

• Character Constants.
e.g. ‘E’
‘h’
‘=’
‘8’

• Real Constants.
e.g. 488.22 +3.211e-4
+85.23 5.6e4
-11.20

-7- By: Kute T. B. for FYIF (2007-08)


Data types declaration.

int a; /* General declaration */


int a = 10; /* Valued Declaration */
float b = 12.6;
float b;
char c;
char c = ‘y’;

Maximum values of Data Types.

• int requires 2 bytes to store in memory.


-32768 to 32767.
• float requires 4 bytes to store.
-3.4e38 to 3.4e38.
• char requires 1 byte to store.
A….Z and a….z also special symbols.
• long int requires 4 bytes to store.
-2147483648 to 2147483647.
• double requires 8 bytes to store.
-1.7e308 to 1.7e308.
• long double requires 10 bytes to
store.
-1.7e4932 to 1.7e4932.

-8- By: Kute T. B. for FYIF (2007-08)


Keywords.

auto break case char


const continue default do
double else enum extern
float for goto if
long register return short
signed sizeof static struct
switch typedef union unsigned
void while volatile near
far asm

Operators.

• Numerial operators.

• Logical operators.

• Relational operators.

• Conditional operators.

• Bitwise operators.

-9- By: Kute T. B. for FYIF (2007-08)


Numerical operators.

+ - * / % = +=
++ -- -= *=
--------------------------------------------------------
e.g. int a, y = 10, x = 12;
float b;
a = y + 10;
b = x / 2;
a = a – b;
Relational operators.

> < >= <= == !=


Logical operators.

&& || !
Conditional operators.

? :
Bitwise operators.

& | ~ ^ >> <<


- 10 - By: Kute T. B. for FYIF (2007-08)
Special Operators:

. # \ / : ->
sizeof (type)
Seperators:
; , () [] {}
<> “ ” ‘ ’ `
Comments

/* */
//
Types of Operators:
1. Unary
2. Binary
3. Ternary

- 11 - By: Kute T. B. for FYIF (2007-08)


Expression and Statements.
int a = -10, j = 26;
float r = 5.22, t = 2.66 + 45.2 * 2;
float b = 1.02 , c = b / 2 + 5.2;
int d, e, f, g;
d = e = f= g = 50;
float alpha = 23.001, beta = 892.00;
float delta = alpha*beta/3.2–alpha;
char h, i ;
h = ‘D’;
i = h;

Hierarchy of operations.
int i;
i = 5 * 6 – 8 + 9 – (43 + 2) /5 – 5;
i = 30 – 8 + 9 – 45/5 – 5;
i = 30 – 8 + 9 – 9 – 5;
i = 22 + 0 – 5;
i = 17;

- 12 - By: Kute T. B. for FYIF (2007-08)


Format Specifiers

%c Character format specifier.


%d Integer format specifier.
%e Scientific notation format specifier.
%E Scientific notation format specifier.
%f Floating-point format specifier.
%g Uses %f or %e, whichever result is
shorter.
%G Uses %f or %E, whichever result is
shorter.
%i Integer format specifier (same as %d).
%n Records the number of characters
written so far.
%o Unsigned octal format specifier.
%p Displays the corresponding argument
that is a pointer.
%s String format specifier.
%u Unsigned integer format specifier.
%x Unsigned hexadecimal format
specifier.
%X Unsigned hexadecimal format
specifier.
%% Outputs a percent sign (%).

- 13 - By: Kute T. B. for FYIF (2007-08)


How Compiler Works ?

- 14 - By: Kute T. B. for FYIF (2007-08)


Operator Associativity

Category Operator Associativity


Postfix () [] -> . ++
-- Left to right

Unary + - ! ~ ++
- - (type) * & sizeof Right to left

Multiplicative * / %
Left to right
Additive + -
Left to right
Shift << >>
Left to right
Relational < <= > >=
Left to right
Equality == !=
Left to right
Bitwise & ^ |
Left to right
Logical && ||
Left to right
Conditional ?:
Right to left
Assignment = += -= *= /= %=
>>= <<= &= ^= |= Right to left

Comma , Left to right

- 15 - By: Kute T. B. for FYIF (2007-08)


Compilation Process in ‘C’

Editor
Source Code
Pre-processor
Expanded
Compiler Source Code
Assembly
Assembler Language
Code

Linker Object Code

Executable
Loader
Code

.exe file of your


program

- 16 - By: Kute T. B. for FYIF (2007-08)


Escape Sequences in C

Character Meaning
\n New Line
\t Tab
\b Backspace
\v Vertical Tab
\a Audible Alert
(Bell)
\r Carriage Return
\f Form feed
\\ Backslash
\’ Single Quote
\” Double Quote

- 17 - By: Kute T. B. for FYIF (2007-08)

Das könnte Ihnen auch gefallen