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.

Slides:



Advertisements
Similar presentations
CSE 105 Structured Programming Language (C)
Advertisements

Agenda Definitions Evolution of Programming Languages and Personal Computers The C Language.
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.
Systems Software.
Programming In C++ Spring Semester 2013 Lecture 2 Programming In C++, Lecture 2.
Chapter 3: Beginning Problem Solving Concepts for the Computer Programming Computer Programming Skills /1436 Department of Computer Science.
Introduction to C Programming CE Lecture 1 Introduction to C.
Three types of computer languages
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
Computers: Tools for an Information Age
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?
 2003 Prentice Hall, Inc. All rights reserved. 1 Machine Languages, Assembly Languages, and High-level Languages Three types of computer languages 1.Machine.
1 ICS103 Programming in C Lecture 2: Introduction to C (1)
Guide To UNIX Using Linux Third Edition
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
1 Chapter Two Introduction to the Programming Language C.
Introduction to C Programming
C programming Language and Data Structure For DIT Students.
CHAPTER 1: INTORDUCTION TO C LANGUAGE
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
Using C Programming Language.  The programs that run on a computer are referred to as software.  You’ll learn key programming methodology that are enhancing.
Computer Science 210 Computer Organization Introduction to C.
Programming In C++ Spring Semester 2013 Programming In C++, Lecture 1.
CS102 Introduction to Computer Programming
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
“C” Programming Language What is language ? Language is medium of communication. If two persons want to communicate with each other, they have to use.
Basics of “C” Programming
UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.
CHAPTER 1 Overview of Programming and Problem Solving.
History of C and C++ C++ evolved from C ANSI C C++ “spruces up” C
Programming With C.
History of C 1950 – FORTRAN (Formula Translator) 1959 – COBOL (Common Business Oriented Language) 1971 – Pascal Between Ada.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 1 February 8, 2005.
Programming Fundamentals. Today’s Lecture Why do we need Object Oriented Language C++ and C Basics of a typical C++ Environment Basic Program Construction.
1 Programming in C Hello World! Soon I will control the world! Soon I will control the world!
INTRODUCTION Kingdom of Saudi Arabia Princess Nora bint Abdul Rahman University College of Computer Since and Information System CS240.
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm.
Module 4 Part 2 Introduction To Software Development : Programming & Languages Introduction To Software Development : Programming & Languages.
Programming in C++ Dale/Weems/Headington Chapter 1 Overview of Programming and Problem Solving.
Agenda Computer Languages How to Write a Simple C Program
CS-303 Introduction to Programming
CHAPTER 1: INTRODUCTION C++ Programming. CS 241 Course URL: Text Book: C++ How to Program, DETITEL & DEITEL, eighth Edition.
Chapter 1 Introduction to Computers, the Internet and the Web.
Silberschatz and Galvin  C Programming Language Kingdom of Saudi Arabia Ministry of Higher Education Al-Majma’ah University College of Education.
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.
MAHENDRAN. Session Objectives Session Objectives  Discuss the Origin of C  Features of C  Characteristics of C  Current Uses of C  “C” Programming.
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:
Chapter 1: Introduction to Computers and Programming.
Chapter 1 slides1 What is C? A high-level language that is extremely useful for engineering computations. A computer language that has endured for almost.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
PROGRAMMING (1) LECTURE # 1 Programming and Languages: Telling the Computer What to Do.
BIL 104E Introduction to Scientific and Engineering Computing Lecture 1.
Computer Science 210 Computer Organization
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
' C ' PROGRAMMING SRM-MCA.
Computer Science 210 Computer Organization
Introduction to C Programming
Programming Fundamentals Lecture #3 Overview of Computer Programming
Introduction to Computer Programming
C programming Language
Introduction to Computer Programming
Computer Programming-1 CSC 111
Presentation transcript:

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 Bell Laboratories in the 1972s in USA. It is also called as 'Procedure oriented programming language.' C is not specially designed for specific applications areas like COBOL (Common Business-Oriented Language) or FORTRAN (Formula Translation). It is well suited for business and scientific applications. It has some various features like control structures, looping statements, arrays, macros required for these applications

What is C? C n A language written by Brian Kernighan and Dennis Ritchie. This was to be the language that UNIX was written in to become the first "portable" language In recent years C has been used as a general- purpose language because of its popularity with programmers.

Why C Still Useful? C provides: u Efficiency, high performance and high quality s/ws 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…..  Note! Program correctness and robustness are most important than program efficiency

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

Structure of C program Global variable and function declaration Include files Function subprogram Main functions

The preprocessor  The preprocessor takes your source code and – following certain directives that you give it – tweaks it in various ways before compilation.  A directive is given as a line of source code starting with the # symbol  The preprocessor works in a very crude, “word-processor” way, simply cutting and pasting – it doesn’t really know anything about C! Your source code Preprocessor Enhanced and obfuscated source code Compiler Object code

Simple C Program /* A first C Program*/ #include void main() { printf("Hello World \n"); }

Simple C Program Line 1: #include As part of compilation, the C compiler runs a program called the C preprocessor. The preprocessor is able to add and remove code from your source file. In this case, the directive #include tells the preprocessor to include code from the file stdio.h. This file contains declarations for functions that the program needs to use. A declaration for the printf function is in this file.

Simple C Program Line 2: void main() This statement declares the main function. A C program can contain many functions but must always have one main function. A function is a self-contained module of code that can accomplish some task. Functions are examined later. The "void" specifies the return type of main. In this case, nothing is returned to the operating system.

Simple C Program Line 3: { This opening bracket denotes the start of the program.

Simple C Program Line 4: printf("Hello World From About\n"); Printf is a function from a standard C library that is used to print strings to the standard output, normally your screen. The compiler links code from these standard libraries to the code you have written to produce the final executable. The "\n" is a special format modifier that tells the printf to put a line feed at the end of the line. If there were another printf in this program, its string would print on the next line.

Simple C Program Line 5: } This closing bracket denotes the end of the program.

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

Memory concepts Every variable has a name, type and value Variable names correspond to locations in computer memory New value over-writes the previous value– “Destructive read-in” Value reading called “Non-destructive read-out”

Comment Comment should be enclosed between /* */ It is used to increase the readability of the program. Any number of comments can be given at any place in the program. Comment cannot be nested It can be split over more than one line

Communicating with a computer involves speaking the language the computer understands. Steps in learning English language Steps in learning C Alphabets Digits Special-symbols Constants Variables Keywords InstructionProgram Getting started with C Alphabets Sentences Paragraph Words

Question 1. What are the general characteristics of C and where was C originally developed and by whom? Question 2. Explain the structure of C program. and explain the purpose of printf and scanf function.