“C” Programming Language What is language ? Language is medium of communication. If two persons want to communicate with each other, they have to use.

Slides:



Advertisements
Similar presentations
Programming In C++ Spring Semester 2013 Programming In C++, Lecture 1
Advertisements

Module 6: Introduction to C Language ITEI102 Introduction to Programming Structure of C++ Program - Programming Terminologies - Microsoft Visual Studio.
EC-111 Algorithms & Computing Lecture #1 Instructor: Jahan Zeb Department of Computer Engineering (DCE) College of E&ME NUST.
Introduction to Programming Lecture 2. Today’s Lecture Software Categories Software Categories System Software System Software Application Software Application.
Systems Software.
Chapter 3: Beginning Problem Solving Concepts for the Computer Programming Computer Programming Skills /1436 Department of Computer Science.
Introduction Kingdom of Saudi Arabia Shaqra University
Three types of computer languages
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
1 Key Concepts:  Why C?  Life Cycle Of a C program,  What is a computer program?  A program statement?  Basic parts of a C program,  Printf() function?
Introduction to Computer Programming CSC 1401: Introduction to Programming with Java Lecture 2 Wanda M. Kunkle.
Chapter 1 Introduction to C Programming. 1.1 INTRODUCTION This book is about problem solving with the use of computers and the C programming language.
 2003 Prentice Hall, Inc. All rights reserved. 1 Machine Languages, Assembly Languages, and High-level Languages Three types of computer languages 1.Machine.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 1 – Introduction to Computers and C++ Programming Outline 1.1Introduction 1.2What Is a Computer?
Introduction to C Programming
C programming Language and Data Structure For DIT Students.
CHAPTER 1: INTORDUCTION TO C LANGUAGE
 2000 Prentice Hall, Inc. All rights reserved. 1 Introduction to Computers and C Programming Outline Introduction What Is a Computer? Computer Organization.
Copyright 2003 Scott/Jones Publishing Brief Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
COMPUTER PROGRAMMING. Introduction to C++ History Merges notions from Smalltalk and notions from C The class concept was borrowed from Simular67 Developed.
Programming In C++ Spring Semester 2013 Programming In C++, Lecture 1.
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
COMPUTER SCIENCE I C++ INTRODUCTION
Lecture 1: Introduction to Computers. OBJECTIVES In this lecture you will learn:  Basic computer concepts.  The different types of programming languages.
Programming Design Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University.
Basics of “C” Programming
 2008 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and World Wide Web.
Spring 2005, Gülcihan Özdemir Dağ BIL104E: Introduction to Scientific and Engineering Computing, Spring Outline 1.1Introduction 1.2What Is a Computer?
CSC141 Introduction to Computer Programming
History of C and C++ C++ evolved from C ANSI C C++ “spruces up” C
C++ Programming Language Lecture 1 Introduction By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Programming With C.
Introduction to C++ Programming Language
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Introduction to Computers Outline 1.1Introduction.
Introduction to Programming Lecture No. 1. Books  Deitel & Deitel :– C++ How to Program  Kernighan and Ritchie:- The C Programming Language.
 2006 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and World Wide Web.
Evolution and History of Programming Languages. Machine languages Assembly languages Higher-level languages To build programs, people use languages that.
Evolution and History of Programming Languages. Software Programming Language.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 1 Introduction to Computers, the Internet and.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 1 February 8, 2005.
INTRODUCTION Kingdom of Saudi Arabia Princess Nora bint Abdul Rahman University College of Computer Since and Information System CS240.
INTRODUCTION TO COMPUTING CHAPTER NO. 04. Programming Languages Program Algorithms and Pseudo Code Properties and Advantages of Algorithms Flowchart (Symbols.
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
1 Programming Fundamentals How to Program in C++ How to Program in C++
COMPUTER PROGRAMMING. Computer programming the objective of the module to gain the necessary skills to develop a computer program using one of the high.
CS-303 Introduction to Programming
Programming Fundamentals Lecture No. 2. Course Objectives Objectives of this course are three fold 1. To appreciate the need for a programming language.
CHAPTER 1: INTRODUCTION C++ Programming. CS 241 Course URL: Text Book: C++ How to Program, DETITEL & DEITEL, eighth Edition.
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
Chapter 1 Introduction to Computers, the Internet and the Web.
CHAPTER 1.1 INTRODUCTION TO COMPUTERS AND C++ Dr. Shady Yehia Elmashad.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 1 – Introduction to C.
Introduction to C Programming Language. History of C  C was evolved by Dennis Ritchie at AT&T Bell Laboratories in early of 1970s  Successor of: ALGOL.
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
An overview of C Language. Overview of C C language is a general purpose and structured programming language developed by 'Dennis Ritchie' at AT &T's.
Evolution of C and C++ n C was developed by Dennis Ritchie at Bell Labs (early 1970s) as a systems programming language n C later evolved into a general-purpose.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
Introduction to computer programming
BIL 104E Introduction to Scientific and Engineering Computing Lecture 1.
Chapter 1: Introduction to computers and C++ Programming
CSC201: Computer Programming
CSCI-235 Micro-Computer Applications
Instructor: Chien-Ho Ko
Intro to Programming Week # 1 Hardware / Software Lecture # 2
Overview of C.
Welcome In The World Of ‘C’.  TEXT BOOK: Programming in ANSI ‘C By: E Balagurusamy. TMH  Reference Books: 1) The ‘C Programming Language By: Kernighan.
Introduction to C Programming
Programming Fundamentals Lecture #3 Overview of Computer Programming
C programming Language
Introduction to Computer Programming
Presentation transcript:

“C” Programming Language

What is language ? Language is medium of communication. If two persons want to communicate with each other, they have to use a common language. Like Hindi, English, Punjabi …….

What is Programming Language ? Much in the same way when a user wants to communicate with a computer,the language that he/she uses for this purpose is known as programming language. Like C, C++, JAVA …… At the same time we know that computer understands only one language that is MACHINE LANGUAGE. This language comprises of only 0 & 1. It’s very difficult for us to learn this language. For Example two persons belonging to two different countries, want to communicate then there may be a problem of common communication medium. To solve this problem there is a requirement of translator.

Types of Programming language Basically there are two types of Programming languages. Programming. Language Low Level Languages High Level Languages Machine Language Assembly language JAVA C++ C

Programming languages Various programming languages Some understandable directly by computers Others require “translation” steps –Machine language Natural language of a particular computer Consists of strings of numbers(1s, 0s) Instruct computer to perform elementary operations one at a time Machine dependant

Programming languages Assembly Language –English like abbreviations –Translators programs called “Assemblers” to convert assembly language programs to machine language. –E.g. add overtime to base pay and store result in gross pay LOADBASEPAY ADDOVERPAY STOREGROSSPAY

Programming languages High-level languages –To speed up programming even further –Single statements for accomplishing substantial tasks –Translator programs called “Compilers” to convert high- level programs into machine language –E.g. add overtime to base pay and store result in gross pay grossPay = basePay + overtimePay

Types of Translator Compiler Interpreter Assembler SOURCE CODE SOURCE CODE SOURCE CODE OBJECT CODE OBJECT CODE OBJECT CODE

Basics of “C”

Why use C? Mainly because it produces code that runs nearly as fast as code written in assembly language. Some examples of the use of C might be: –Operating Systems –Language Compilers –Assemblers –Text Editors –Print Spoolers –Network Drivers –Modern Programs –Data Bases –Language Interpreters –Utilities

Why C Still Useful? C provides: u Efficiency, high performance and high quality u flexibility and power u many high-level and low-level operations  middle level u Stability and small size code u Provide functionality through rich set of function libraries u Gateway for other professional languages like C  C++  Java C is used: u System software Compilers, Editors, embedded systems u data compression, graphics and computational geometry, utility programs u databases, operating systems, device drivers, system level routines u there are zillions of lines of C legacy code u Also used in application programs

Software Development Method Requirement Specification –Problem Definition Analysis –Refine, Generalize, Decompose the problem definition Design –Develop Algorithm Implementation –Write Code Verification and Testing –Test and Debug the code

Development with C Four stages  Editing: Writing the source code by using some IDE or editor  Preprocessing or libraries: Already available routines  compiling: translates or converts source to object code for a specific platform source code -> object code  linking: resolves external references and produces the executable module  Portable programs will run on any machine but…..  Program correctness and robustness are most important than program efficiency

History In 1972 Dennis Ritchie at Bell Labs writes C and in 1978 the publication of The C Programming Language by Kernighan & Ritchie caused a revolution in the computing world In 1983, the American National Standards Institute (ANSI) established a committee to provide a modern, comprehensive definition of C. The resulting definition, the ANSI standard, or "ANSI C", was completed late 1988.

The Beginning of C

History of C Evolved from two previous languages –BCPL, B BCPL (Basic Combined Programming Language) used for writing OS & compilers B used for creating early versions of UNIX OS Both were “typeless” languages C language evolved from B (Dennis Ritchie – Bell labs) C was developed by Dennis Ritchie at AT & T bell laboratory of USA in 1972.

History of C Hardware independent Programs portable to most computers Dialects of C –Common C –ANSI C ANSI/ ISO 9899: 1990 Called American National Standards Institute ANSI C Case-sensitive

C – A Middle Level Language

C is Middle Level Language C stands in between these two categories. Since it was designed to have both: A relatively good programming efficiency as compared to Machine Oriented Languages. A relatively good Machine efficiency as compared to Problem Oriented Languages. That’s WHY it is called a Middle Level Language.

Application Areas Of C C was initially used for systems programming. A system program forms a portion of the operating system of the computer or its support utilities. Operating Systems, Interpreters, Editors, Assembly programs are usually called system programs. The UNIX operating system was developed using C. There are C compilers available for almost all types of PC’s.

A simple Program of C /* Write a program to print a message */ #include void main() { printf(“ C Programming”); getch( ); }

 Comment about the program should be enclosed within ‘/*’ & ‘*/’.  printf() is a function which is used to print messages on the screen.  main() is a function from which execution of the program starts.  Here stdio.h is a library file which contains standard input/output functions, keywords etc.  #include<> is used to define the library file that is to be used in the program for compiler information.

Compilation & Execution of a Program C Preprocessor Expanded C Source Code C Compiler Target Assembly Code Linker Executable Code Loader Output C Source Code

Basics of C Environment C systems consist of 3 parts –Environment –Language –C Standard Library Development environment has 6 phases –Edit –Pre-processor –Compile –Link –Load –Execute

Basics of C Environment Editor Disk Phase 1 Program edited in Editor and stored on disk Preprocessor Disk Phase 2 Preprocessor program processes the code Compiler Disk Phase 3 Creates object code and stores on disk Linker Disk Phase 4 Links object code with libraries and stores on disk

Basics of C Environment Loader Phase 5 Puts program in memory Primary memory CPU Phase 6 Takes each instruction and executes it storing new data values Primary memory

Execution Process of a Program PROCESSSHORT CUTFILE NAME SaveF2abc.c CompileAlt + F9abc.obj ExecuteCtrl + F9abc.exe Back upAgain F2abc.bak

Escape Sequence \nnew line \ttab \rcarriage return \aalert \\backslash \”double quote

Thanks……