LECTURE/ STUDY NOTES ON C

Similar documents
ITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University

INTRODUCTION 1.1. HISTORY OFUNIX

by Pearson Education, Inc. All Rights Reserved.

CS Prof J.P.Morrison

CS 153 Design of Operating Systems

Instructor. Mehmet Zeki COSKUN Assistant Professor at the Geodesy & Photogrammetry, Civil Eng. (212)

Introduction to C Programming

Unit 1: Introduction to Programming. Saurabh Khatri Lecturer Department of Computer Technology VIT, Pune

An Operating System History of Operating Systems. Operating Systems. Autumn CS4023

PROGRAMMAZIONE I A.A. 2017/2018

EL2310 Scientific Programming

CS 113: Introduction to

Dennis Ritchie. Dennis Ritchie - The Computer Science Pioneer without whom there would be no Jobs

Practical Computing-II. Programming in the Linux Environment. 0. An Introduction. B.W.Gore. March 20, 2015

Introduction to Basis and Practice in Programming

Preview from Notesale.co.uk Page 6 of 52

INTRODUCTION TO OPERATING SYSTEMS. Jo, Heeseung

Introduction to Operating Systems. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

COMP1917: Computing 1 1. Introduction

COMP1917: Computing 1 1. Introduction

1. Introduction. Course Web Site. COMP1917: Computing 1. Textbook. Occupational Health and Safety (OHS)

CSC 453 Operating Systems

CS Operating Systems (OS) Introduction. Lecture 2 Sept 12, 2018

Unit. Programming Fundamentals. School of Science and Technology INTRODUCTION

CSCI 2132 Software Development. Lecture 2: Introduction to UNIX and Unix-like Operating Systems

Introduction to Operating Systems. Jo, Heeseung

The component base of C language. Nguyễn Dũng Faculty of IT Hue College of Science

Lessons Learned from 30 Years of MINIX?! Andrew S. Tanenbaum! Vrije Universiteit!

BIL 104E Introduction to Scientific and Engineering Computing. Lecture 1

Spring 2018 NENG 202 Introduction to Computer Programming

Software Project. Lecturers: Ran Caneti, Gideon Dror Teaching assistants: Nathan Manor, Ben Riva

Course and Unix Intro

Introduction to Operating Systems. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language

Why do we have to know all that? The stored program concept (the procedural paradigm) Memory

C LANGUAGE AND ITS DIFFERENT TYPES OF FUNCTIONS

Unix to Linux. CS 3113 Fall 2018 Dr. Christan Grant

Operating System Labs. Yuanbin Wu

Computer Fundamentals: Pradeep K. Sinha & Priti Sinha

Operating Systems. I. Introduction. Eurecom

Contents. Today's Topic: Introduction to Operating Systems

Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah. Lecturer Department of Computer Science & IT University of Balochistan

1 The Catholic University of Eastern Africa P.o Box , Nairobi Kenya Edward Kioko 2013

Fundamentals of Programming. Lecture 1: Introduction to C Programming

UKNOF September 2007 Early Networks at UKC. Peter Collinson.

Operating Systems. Pablo Prieto Torralbo. 1. Introduction DEPARTMENT OF COMPUTER ENGINEERING

David DeFlyer Class notes CS162 January 26 th, 2009

Embedded Controller Programming 2

Operating System Study Material

Systems Programming. The Unix/Linux Operating System

Introduction to Operating Systems

EL2310 Scientific Programming

Is it time to rewrite the operating system in Rust?

C Language, Token, Keywords, Constant, variable

Lecture 1: Preliminaries

Unix/Linux: History and Philosophy

Computer Programming

Contents. * All rights reserved, Tei-Wei Kuo, National Taiwan University, 2003.

COSC 2P95. Introduction. Week 1. Brock University. Brock University (Week 1) Introduction 1 / 18

CS201 - Lecture 1 The C Programming Language

introduction week 1 Ritsumeikan University College of Information Science and Engineering Ian Piumarta 1 / 20 imperative programming about the course

C Programming for Engineers Introduction

A brief history of Unix

Chapter 1 & 2 Introduction to C Language

C PROGRAMMING THE C PROGRAMMING THE PDF C PROGRAMMING TUTORIAL IN PDF - CURRENT AFFAIRS 2018 C (PROGRAMMING LANGUAGE) - WIKIPEDIA

INFS 214: Introduction to Computing

Department of Computer Applications

CMSC 246 Systems Programming

COURSE OUTLINE. UNIX Programming 2014 Fall by Euiseong Seo

Administration Computers Software Algorithms Programming Languages

Brief Linux Presentation. July 10th, 2006 Elan Borenstein

Appendix to Topic IV

History, Hardware, OS Concepts

CSC 634: Networks Programming

Introduction to Computing Lecture 01: Introduction to C

Programming in C. What is C?... What is C?

Programming in C UVic SEng 265

Operating System Labs. Yuanbin Wu

learning objectives understand the role of an operating system understand the role of interpreters and compilers

ENT 189: COMPUTER PROGRAMMING. H/P: Home page:

Introduction to Computers, the Internet and the Web Pearson Education, Inc. All rights reserved.

tech. solutions T2G Page1 ALT_01_Ch1 : Introduction to Linux ideas and history The History of Linux starts with the earlier development of UNIX.

Chapter 2. 5 * B => A V 6 7 (subscripts) S 1.n 1.n (data types)

Overview of Unix / Linux operating systems

History And Modern Uses Of The Unix Operating System (including embedded devices and mobile phones).

CS133 C Programming. Instructor: Jialiang Lu Office: Information Center 703

Learning C language Programming with executable flowchart language

Introduction to Programming

Operating Systems CS3502 Spring 2018

notice the '' you must have those around character values, they are not needed for integers or decimals.

Fundamental Concepts and History

C Compilation Model. Comp-206 : Introduction to Software Systems Lecture 9. Alexandre Denault Computer Science McGill University Fall 2006

Programming for Engineers: Getting Started

Fundamentals of Programming (C)

BCA-105 C Language What is C? History of C

C++ For Programmers By Paul J. Deitel, Harvey M. Deitel

G51OOP. Object Oriented Programming Comp Sci University of Nottingham Unit 1 : Introduction

History of Unix, Linux and the Open Source

C++ Programming Language Lecture 1 Introduction

Binghamton University. CS-120 Summer Introduction to C. Text: Introduction to Computer Systems : Chapters 11, 12, 14, 13

Transcription:

LECTURE/ STUDY NOTES ON C PART I (Overview of C Programming) Introduction of C language History of C Importance of C Demerits of C Basic Structure of C Working steps of C compiler Source Code Object Code Executable Code

Introduction of C Language C is a general-purpose programming language. Initially, it was thought that C is an exclusively system programming language. But, one can write a wide range of application programs as well in C. Most of the code of operating systems, editors, compilers, word processors, etc is written in C language. C has been one of the most popular programming languages since its early days till today. C is a structured and procedural programming language. Can you give an example of unstructured programming language? Although it is possible to write object oriented programs in C, it is very difficult to do so and hence we can say that C does not support object oriented programming. C is a high-level programming language though some authors refer to it as mid-level programming language. It must be noted that the syntax, and hence the whole code, of C is somewhat disconcerting to new programmers. Moreover, C is highly flexible in that it is well-suited for system programming as well as application programming. History of C C was born at Bell Telephone Laboratories, Inc (popularly referred to as Bell Labs and now part of AT&T). C was developed by Dennis Ritchie in 1972. Interestingly, C was designed and developed to implement the Unix TM Operating System on a then new system, PDP-11 (of Digital Equipment Corporation or simply DEC). The history of C is therefore very much tied with the history of Unix. In the computer world, the first machines (between the 1940s and the 1950s) ran only one program at a time and only one user could have access to the machine at a given time. In the 1960s, batch systems came into existance. In this scheme, programmers would submit their jobs on punched cards and a batch of many jobs would be read by the computer. This too was unsatisfactory to many users because after submitting a job the programmer had to wait for few hours to get the output. So, to come around this problem, the concept of timesharing was introduced at Darmouth College,?????? and MIT. After the initial success a better timesharing system called MULTICS was being built by MIT, Bell Labs & General Electric together. Due to some reasons Bell Labs pulled out of the MULTICS project. One of the researchers of Bell Labs, Ken Thompson wanted to continue working in this line and eventually wrote a simpler

version of MULTICS (using assembler) for a discarded PDP-7 minicomputer. Another researcher at Bell Labs, Brian Kernighan, jokingly called the new operating system UNICS (Uniplexed Information and Computing Service). Did you get the joke? If not, UNICS and eunuchs rhyme well. What Brian Kernighan wanted to suggest is that UNICS was a stripped down form of MULTICS. The name, however, stuck. Only the spelling was later changed to Unix. So, where is C? Well, UNIX was such a huge success that many researchers of Bell Labs joined to improve the Unix. The first problem occurred when Unix was to be ported to newer systems like PDP-11/45 & PDP-11/70. These systems are different and hence Unix had to be re-written for these systems. This is a great problem for the developers. A solution was to use a high-level language instead of assembly language. Ken Thompson did exactly that. The problem was that he used his own designed language called B. B was descended from BCPL, BCPL descended from CPL. Now, B had many shortcomings due to which Unix could not be rewritten. At that time, Dennis Richie came to the rescue. He designed a successor to B, called C. A compiler was written for C. Now, Thompson and Ritchie together rewrote Unix in C. Since then, C was refined and presently it is??????????? Another interesting fact is that Ritchie's compiler produced object code only for the PDP-11. It was Steve Johnson, also of Bell Labs, who improved the work of Ritchie and implemented the portable C compiler. It became easier to produce the object code for almost any machine. Slowly, C begun to be used in universities. But the real explosion of C occurred in 1978 after the publication of a book The C Programming Language by Brian Kernighan and Dennis Ritchie. Since then, several versions of the C Compiler was wrote by different individuals or groups and it also led to problems in compatibility. So, it was required to standardise C. In 1983, ANSI begun its work and finally in 1989 the standard C known as ANSI C was approved. ISO also approved ANSI C in 1990. It was revised again in 1999.

Importance of C Any college, institute or university has C language as on of the core programming language in its curriculum. Two other languages that find their places in Computer Science & Engineering courses are C++ and Assembly language programming. This is despite the fact that there are numerous languages available and are also being used by several software developers. Only few colleges teach languages such as Java, Visual Basic, etc. Definitely, then, C must have its advantages over other languages? Well, C language is very well suited for writing system programs/ software like compilers, linkers, drivers and the operating system. On the other hand, C is also used for writing application programs, spreadsheet programs, database management programs, games, etc. In other words, C is highly flexible. Other than that, C is relatively a small language. It has only 32 keywords. There are only a few basic data types like character, integer and float data types. In fact, there is no built-in input/output facilities. Those are done with the help of functions. Functions, whether library or user-defined, also extend the C language and they also help C programs to be more compact. Learners and practitioners of C simply love it because it is, in the words of Kernighan and Ritchie, pleasant, expressive & versatile. They also write that C wears well as one's experience with it grows.

In my point of view, C is very important than any other language because it helps build system software. Both Unix and Windows operating systems are written mostly in C. For e.g., Windows NT 4.0 is written of 16 million lines of code, mostly of C. And, Unix Version 7 consisted of 18,800 lines of C & 2100 lines of assembly language program. In fact, the core software of any computer system is written in C. Therefore, students are taught and encouraged to learn C. Moreover, once a person becomes familiar with C, learning other languages becomes quite easy. This is the very logic followed by the curriculum framers of Computer Science and Engineering courses. Moreover, reputed software companies also look for graduates with a solid knowledge of C, C++, & assembly language programming. After that, they train the new recruits for few months in the programming language that the respective companies uses for building software. Demerits of C I do not know about the demerits of C. It is left as a homework to you students. This is because you are in a better position to complain against C. When I first learnt C, I disliked C because it seemed a bit cryptic. It is not like the language GW- BASIC I previously learnt in school. GW-BASIC was very much like English in that the commands were like: PRINT, LET, INPUT, END, etc. On the contrary, I was very discouraged at first to see things like: #include <stdio.h>, printf( %6.2f, temp), etc. It didn't make much sense at first. However, other than these challenges that every beginner faces, I find no other demerits of C. Kernighan and Ritchie also points out some of the deficiencies of C: some of the operators have the wrong precedence, some parts of the syntax could be better. Well, other than the ones pointed out above, you are invited to find out the demerits of C.