C Programming.

Slides:



Advertisements
Similar presentations
C Programming for engineers Teaching assistant: Ben Sandbank Home page:
Advertisements

Introduction to C Programming CE Lecture 1 Introduction to C.
Programming The Development Environment and Your First C Program.
Three types of computer languages
Unix Continuum of Tools Do something once: use the command line Do something many times: –Use an alias –Use a shell script Do something that is complex.
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.
CS 101 Problem Solving and Structured Programming in C Sami Rollins Spring 2003.
CMSC 104, Version 9/011 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program 104 C Programming Standards and Indentation.
C programming Language and Data Structure For DIT Students.
Introduction to C. A Brief History Created by Dennis Ritchie at AT&T Labs in 1972 Originally created to design and support the Unix operating system.
Introduction To C++ Programming 1.0 Basic C++ Program Structure 2.0 Program Control 3.0 Array And Structures 4.0 Function 5.0 Pointer 6.0 Secure Programming.
CHAPTER 1: INTORDUCTION TO C LANGUAGE
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.
Introduction to C Programming. A Brief History u Created by Dennis Ritchie at AT&T Labs in 1972 u Originally created to design and support the Unix operating.
CSC141 Introduction to Computer Programming
1 Agenda Administration Background Our first C program Working environment Exercise Memory and Variables.
Programming With C.
1 計算機程式設計 Introduction to Computer Programming Lecture01: Introduction and Hello World 9/10/2012 Slides modified from Yin Lou, Cornell CS2022: Introduction.
History of C 1950 – FORTRAN (Formula Translator) 1959 – COBOL (Common Business Oriented Language) 1971 – Pascal Between Ada.
CMSC 104, Version 9/011 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program 104 C Programming Standards and Indentation.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
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.
Algorithms  Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
CHAPTER 1 INTRODUCTION 1 st semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Introduction to C 2008/09/29: Lecture 7 CMSC 104, Section 0101 John Y. Park 1.
Programming in C++ Dale/Weems/Headington Chapter 1 Overview of Programming and Problem Solving.
Agenda Computer Languages How to Write a Simple C Program
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
The Hashemite University Computer Engineering Department
 Getting ready to code Lecture 1 Match 4, Course syllabus 
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.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
INTRODUCTION TO PROGRAMING System Development Mansoura October 2015.
Software Engineering Algorithms, Compilers, & Lifecycle.
Introduction to C Topics Compilation Using the gcc Compiler
Chapter 1 Introduction 2nd Semester H
Computer Systems Nat 5 Computing Science
C Programming.
Problem Identification
Computer Systems Nat 5 Computing Science
C Programming Hardik H. Maheta.
Instructor: Chien-Ho Ko
Computer System and Programming
Algorithms Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Problem Solving Using C: Orientation & Lecture 1
Introduction to C Topics Compilation Using the gcc Compiler
Introduction to C Programming Language
TRANSLATORS AND IDEs Key Revision Points.
Problem Solving.
Problem Solving Using C: Orientation & Lecture 1
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Programming Fundamentals Lecture #3 Overview of Computer Programming
2008/09/29: Lecture 7 CMSC 104, Section 0101 John Y. Park
Your first C and C++ programs
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Problem Solving Using C: Orientation & Lecture 1
C programming Language
ECE 103 Engineering Programming Chapter 1 Introduction
The C Language: Intro.
An Overview of C.
C Programming.
Introduction to C Topics Compilation Using the gcc Compiler
Presentation transcript:

C Programming

Course Basics Instructor Lectures TA Joonwon Lee joonwon at skku edu 031 299 4592 Semiconductor Bldg 400626 TA 한용섭 이준호 1~2 hours lectures at 400112 Monday 13:30 2~3 hours lab at 400202 Wednesday 12:00

Course Materials Textbook Kelley A., Pohl I, "A Book on C: Programming in C", Fourth Edition, Addison-Wesley, 1998, ISBN 0-201-18399-4. http://www.cs.ucsc.edu/~pohl/abc4.html Course Web - http://csl.skku.edu/GEDB029F16-41/Overview Laboratory conducted by TA lectures and programming exercises Homeworks 5 individual homeworks

Academic Honesty All work submitted for credit must be your original ones. Cheating on lab or homework “F” grade and a report to the Dean Cheating on examination report to the president of SKKU No exception on dishonesty

All you have to know about computers for C programming Computers play with numbers only everything is represented by numbers pictures, numbers, music binary: bit, byte, word, half word There are CPU and memory disk, keyboard, screen, of course

intentional blank page

You need a language to tell computers to do what you want Korean, English, ... natural languages are used by human very difficult for computers to understand binary numbers are used by computers very difficult for human to understand Find the 100th prime number 00001111 10111111 01000101 11111000 00001111 10111111 01001101 11111000

Programming Languages a language that describes what to do for a computer machine language binary only an expert use it assembly language alphabet most embedded system high-level language C, Java, C++, ... most software 00001111 10111111 01000101 11111000 00001111 10111111 01001101 11111000 00000011 10100001 01100110 10001001 01000101 11111010 MOV AX, MIDSCORE MOV CX, FINALSCORE ADD AX CX MOV TOTALSCORE, AX TotalScore = MidScore + FinalScore;

An Introduction to C 1972: developed by Dennis Ritchie 1989: ANSI C to develop an OS(Unix) for PDP-11 small efficient 1989: ANSI C portable C99 by ISO not by MS

C, C++, Java Java is safe and elegant, but slow C++ is unsafe and fast, also complex C is unsafe, but fast and simple a small language (not many features) portable modular basis for C++ and Java

Program Development Cycle Requirement Analysis Algorithm Coding Compile & Link Execution & Debugging Maintenance

Requirement A document that describes what should be done with your program homework and lab assignment It should be as accurate as possible e.g.) find employees with 3 years experiences regular? temp? 3 calendar years?

Algorithm A procedure for the solution e.g. natural language flow chart pseudo code e.g. read one employee record if experience is longer than 3 years print name repeat step 1,2 until all employee records are read the most important step in programming

Coding choose a programming language describe your algorithm using C C, of course describe your algorithm using C understand C grammar understand C behaviour a program written in C is called source program coding is relatively simple task

Compile Remember computers understand only binary numbers A program in C should be translated into a machine language this process is called compile funny name!! Grammatical sanity is checked #include <stdio.h> int main(void) { printf("Hello, world!\n"); return 0; } C compiler 00001111 10111111 01000101 11111000 00001111 10111111 01001101 11111000 00000011 10100001 01100110 10001001 01000101 11111010

Link Sometimes, your program is too large to fit in a single file you get many files of program you need to combine(link) all of them into a single program Library programs prepared by other people for your convenience

Execution & Debugging after compile, you get a file containing machine code that can be executed on a computer >>a.out run time errors are easy to correct divide by zero, segmentation fault, ... logical errors are from your mind!!

#include <stdio.h> int main(void) { printf("Hello, world!\n"); # for preprocessor indicates where to look for printf() function .h file is a header file entry point called on program start only one main( ) in any program #include <stdio.h> int main(void) { printf("Hello, world!\n"); return 0; } belongs to stdio.h “Hello....” is a parameter to printf()