Lecture 7
Samin Khaliq
Today’s Lecture
• Programming Languages • History of C • Problem Solving
– Flowcharts – Algorithms – Programs
• C Program • Comments
Types of Programming Languages
Low Level Languages
1. Machine language (1GL)
• • Strings of numbers giving machine specific instructions Example: Calculates nth Fibonacci number
8B542408 FA027706 B9010000 C84AEBF1 83FA0077 06B80000 0000C383 B8010000 00C353BB 01000000 008D0419 83FA0376 078BD98B 5BC3
2. Assembly language (2GL)
• • English-like abbreviations representing elementary computer operations (translated via assemblers) Example: fib: mov edx, [esp+8] cmp edx, 0 ja @f mov eax, 0 ret …
3
Types of Languages
3. High-level languages (3GL)
• Codes similar to everyday English • Use mathematical notations (translated via compilers) • Example: grossPay = basePay + overTimePay
• Languages:
– C, C++, Java, FORTRAN, COBOL, Pascal
4
Development of programming languages
Development of Programming Languages
• 2000 C# . . • 2001 Visual Basic .NET . . . . • 2009 Go by Google Inc. (Similar to C)
A brief history of C
• Developed Dennis M. Ritchie at AT&T Bell Labs between 1969–1973 for UNIX • Descendant of Ken Thompson’s language “B” • First published specification standard:
– Ritchie and Brian Kernighan “The C Programming Language” in 1978
– C-dialect now known as K&R-Style
• Ease of portability ⇒ language began to spread • However language standard (K&R) insufficiently precise • A slightly modified version of K&R was standardised by ANSI 1989
– C-dialect now known as ANSI-C
• The latest revision of the Standard is C99 (ISO) • ISO/IEC JTC1/SC22/WG14 is the international standardization working group for the programming language C.
Dennis Ritchie and Ken Thompson
C and C++
• C++ is descended from C
– Written by Bjarne Stroustrup during 1983-1985 – Originally called “C with Classes”
• ISO/IEC JTC1/SC22/WG21 has