1 Chapter Two Introduction to the Programming Language C.

Slides:



Advertisements
Similar presentations
C++ Introduction.
Advertisements

Module 6: Introduction to C Language ITEI102 Introduction to Programming Structure of C++ Program - Programming Terminologies - Microsoft Visual Studio.
Systems Software.
Chapter 3: Beginning Problem Solving Concepts for the Computer Programming Computer Programming Skills /1436 Department of Computer Science.
Chapter 1: Introduction
16/13/2015 3:30 AM6/13/2015 3:30 AM6/13/2015 3:30 AMIntroduction to Software Development What is a computer? A computer system contains: Central Processing.
C Programming Language 4 Developed in 1972 by Dennis Ritchie at AT&T Bell Laboratories 4 Used to rewrite the UNIX operating system 4 Widely used on UNIX.
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?
CS211 Data Structures Sami Rollins Fall 2004.
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.
1 ICS103 Programming in C Lecture 2: Introduction to C (1)
Guide To UNIX Using Linux Third Edition
CS 101 Problem Solving and Structured Programming in C Sami Rollins Spring 2003.
C programming Language and Data Structure For DIT Students.
Copyright 2003 Scott/Jones Publishing Brief Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Computer Science 210 Computer Organization Introduction to C.
Programming In C++ Spring Semester 2013 Programming In C++, Lecture 1.
Introduction to High-Level Language Programming
Introducing Java.
“C” Programming Language What is language ? Language is medium of communication. If two persons want to communicate with each other, they have to use.
Programming Design Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
INTRODUCTION TO C PROGRAMMING LANGUAGE Computer Programming Asst. Prof. Dr. Choopan Rattanapoka and Asst. Prof. Dr. Suphot Chunwiphat.
Spring 2005, Gülcihan Özdemir Dağ BIL104E: Introduction to Scientific and Engineering Computing, Spring Outline 1.1Introduction 1.2What Is a Computer?
Introduction to Computer & C Computers Computers are programmable machines capable of performing calculations Examples of special-purpose computers are.
Chapter 3: Completing the Problem- Solving Process and Getting Started with C++ Introduction to Programming with C++ Fourth Edition.
H.Melikian Introduction on C C is a high-level programming language that forms the basis to other programming languages such as C++, Perl and Java. It.
Programming I Introduction Introduction The only way to learn a new programming language is by writing programs in it. The first program to.
Chapter 1 Introduction. Goal to learn about computers and programming to compile and run your first Java program to recognize compile-time and run-time.
Programming With C.
Programming Fundamentals. Today’s Lecture Why do we need Object Oriented Language C++ and C Basics of a typical C++ Environment Basic Program Construction.
Course Title: Introduction to C++ Course Instructor: ADEEL ANJUM Chapter No: 01 1 BY ADEEL ANJUM (MCS, CCNA,WEB DEVELOPER)
1 Programming in C Hello World! Soon I will control the world! Soon I will control the world!
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
Introduction to Programming
© 2004 Pearson Addison-Wesley. All rights reserved ComS 207: Programming I Instructor: Alexander Stoytchev
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Agenda Computer Languages How to Write a Simple C Program
 Programming - the process of creating computer programs.
Chapter 1 Introduction to Computers, the Internet and the Web.
The Development Process Compilation. Compilation - Dr. Craig A. Struble 2 Programming Process Problem Solving Phase We will spend significant time on.
Course Title Object Oriented Programming with C++ instructor ADEEL ANJUM Chapter No: 03 Conditional statement 1 BY ADEEL ANJUM (MSc-cs, CCNA,WEB DEVELOPER)
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.
CSCI 161 Lecture 3 Martin van Bommel. Operating System Program that acts as interface to other software and the underlying hardware Operating System Utilities.
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:
Software. Introduction n A computer can’t do anything without a program of instructions. n A program is a set of instructions a computer carries out.
Chapter 1: Introduction to Computers and Programming.
CHAPTER 3 COMPLETING THE PROBLEM- SOLVING PROCESS AND GETTING STARTED WITH C++ An Introduction to Programming with C++ Fifth Edition.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
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.
Chapter 6 Testing and running a solution. Errors X Three types Syntax Logic Run-time.
Software Engineering Algorithms, Compilers, & Lifecycle.
BIL 104E Introduction to Scientific and Engineering Computing Lecture 1.
Introduction to Programming By: Prof. Muhammad Abu Baker Siddique 2 nd Lecture 1.
Debuggers. Errors in Computer Code Errors in computer programs are commonly known as bugs. Three types of errors in computer programs –Syntax errors –Runtime.
Introduction To Software Development Environment.
Computer Science 210 Computer Organization
CSC201: Computer Programming
Microprocessor and Assembly Language
Intro to Programming Week # 1 Hardware / Software Lecture # 2
Computer Science 210 Computer Organization
Chapter 2 – Getting Started
C programming Language
Instructor: Alexander Stoytchev
Chapter 2 part #1 C++ Program Structure
Presentation transcript:

1 Chapter Two Introduction to the Programming Language C

2 The only way to learn a programming language is by writing programs in that language

3 The Programming Language C C is a general-purpose programming language C is developed by Dennis Ritchie at Bell Laboratories C has become one of the most widely used languages in the world

4 The C Programming System C programming language –A set of notations for representing programs C standard library –A set of well-developed programs C programming environment –A set of tools to aid program development

5 Editor The C Programming System Compiler Debugger library programs in machine language user-written programs in C user-written programs in machine language language environment library

6 The First C Program Print the following words hello, world

7 The First C Program #include main( ) { printf(“hello, world\n”); }

8 Programs A C program consists of functions and variables A function contains instructions that specify the operations to be done during the computation Variables denote memory locations that store data used during the computation

9 Functions Functions can be either user-defined functions or library functions A C program begins the execution at the beginning of the function named main A function may call other functions to help it perform one of its subtasks

10 The First C Program #include /* include library information */ main( )/* name of starting function */ {/* beginning of instructions */ printf(“hello, world\n”); /* call library function */ }/* end of instructions */

11 Arguments One method of communicating data between functions is for the calling function to provide a list of values, called arguments, to the called function The parentheses after the function name surround the argument list

12 Strings A character string or string constant is a sequence of characters enclosed in double quotes The backslash \ in a string is used as an escape character. It is used for representing invisible characters Some common escape sequences \\backslash\bbackspace \nnewline\ttab \"double quote\'single quote

13 C Programming Environment Edit Compile Link Execute prog1.c, prog1.h, prog2.c, prog2.h prog1.obj, prog2.obj prog.exe lib.h lib.obj input output Debug

14 C Programming Environment Edit: create the high-level language program files using the editor Compile: translate the high-level language program into the machine language program using the compiler Link: combine user's machine language program and the library using the linker

15 C Programming Environment Execute: run the combined machine language program Debug: correct the errors in the program –syntax errors –linking errors –runtime errors –logical errors

16 Microsoft Visual C++

17 Creating the Source File

18 Creating the Source File

19 Editing the Source File

20 Saving the Source File

21 Saving the Source File

22 Saving the Source File

23 Compiling the Source File

24 Compiling the Source File

25 Compiling the Source File

26 Linking the Object Files

27 Linking the Object Files

28 Executing the Executable File

29 Executing the Executable File

30 Executing the Executable File

31 Debugging Syntax Errors

32 Debugging Linking Errors

33 Debugging Runtime Errors

34 Debugging Logical Errors

35 Debugging Logical Errors All programmers make logic errors (bugs). In particular, you will make logic errors Good programmers is ones who take pains to minimize the number of bugs that persist in the finished code Always be skeptical of your own programs and test them as thoroughly as you can

36 Software Maintenance Software requires maintenance –Bug repair –Feature enhancement The cost of software maintenance constitutes between 80 and 90 percent of the total cost Software engineering is the discipline of writing programs so that they can be understood and maintained by others Good programming style requires developing an aesthetic sense