COMP1917: Computing 1 1. Introduction

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

COMP1917: Computing 1 1. Introduction

EL2310 Scientific Programming

EL2310 Scientific Programming

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

PROGRAMMAZIONE I A.A. 2017/2018

Course Information and Introduction

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

ITT Technical Institute. ET2560T Introduction to C Programming Onsite and Online Course SYLLABUS

CS 261 Fall C Introduction. Variables, Memory Model, Pointers, and Debugging. Mike Lam, Professor

C Introduction. Comparison w/ Java, Memory Model, and Pointers

Computers and Computation. The Modern Computer. The Operating System. The Operating System

CS 211 Programming I for Engineers

CS19001/CS19002 Programming and Data Structures Lab Autumn/Spring Semester. Introduction. Abhijit Das. January 4, 2015

Structure of this course. C and C++ Past Exam Questions. Text books

CS11001/CS11002 Programming and Data Structures Autumn/Spring Semesters. Introduction

CS11002 Programming and Data Structures Spring Introduction

Spring 2018 NENG 202 Introduction to Computer Programming

Programming in C and C++

Introduction to Basis and Practice in Programming

(heavily based on last year s notes (Andrew Moore) with thanks to Alastair R. Beresford. 1. Types Variables Expressions & Statements 2/23

Programming in C and C++

C Programming for Engineers Introduction

CSE 303 Lecture 8. Intro to C programming

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

Introduction to C Programming

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

C++ Programming for Programmers

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

Programming in C UVic SEng 265

COMP s1 Lecture 1

CS 253: Intro to Systems Programming 1/21

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

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

Introduction to Computing Lecture 01: Introduction to C

Programming. Data Structure

CS240: Programming in C

C++ Programming for Programmers using Microsoft Visual C Professional

Module Syllabus. PHILADELPHIA UNIVERSITY Faculty: Information Technology Department: Applied Computer Science

Introduction to Computer Systems

LECTURE/ STUDY NOTES ON C

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

Introduction to C Programming

Algorithms, Data Structures, and Problem Solving

CS 241 Data Organization. August 21, 2018

B. Subject-specific skills B1. Problem solving skills: Supply the student with the ability to solve different problems related to the topics

Welcome to... CS113: Introduction to C

Introduction. 1990s. UNSW/NICTA startup OK Labs Timeline. Operating UNSW. John Lions (19 January December 1998)

Presented By : Gaurav Juneja

Chapters 1 & 2 Programming and Programs

CPS1011. Program Structure {C};

CS240: Programming in C. Lecture 2: Overview

CS 113: Introduction to

Introduction. 1990s. UNSW/NICTA startup OK Labs Timeline. 2000s. Operating UNSW. John Lions (19 January December 1998)

Programming. Introduction to the course

CAAM 420 Fall 2012 Lecture 15. Roman Schutski

Introduction. 1990s. UNSW/NICTA startup OK Labs Timeline. 2000s. Operating UNSW. John Lions (19 January December 1998)

CSCI 192 Engineering Programming 2. Subject Overview

Introduction to C. CS 2060 Week 1. Prof. Jonathan Ventura. Outline Introduction Introduction to C Homework 1 C Coding Style Wrap-up

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

CIS* Programming

CS 240 Fall 2015 Section 004. Alvin Chao, Professor

Introduction to C CMSC 104 Spring 2014, Section 02, Lecture 6 Jason Tang

COURSE OUTLINE. UNIX Programming 2014 Fall by Euiseong Seo

Laboratory 2: Programming Basics and Variables. Lecture notes: 1. A quick review of hello_comment.c 2. Some useful information

Introduction. COMP3231/9201/3891/9283 (Extended) Operating Systems Dr. Kevin Elphinstone Dr. Leonid Ryzhyk

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

Week 1 Introduction to Computer and Algorithm (Part1) UniMAP Sem II 11/12 DKT121: Basic Computer Programming 1

Programming for Engineers: Getting Started

Problem Set 1: Unix Commands 1

Your first C and C++ programs

Programming I Laboratory - lesson 01

2 Compiling a C program

Chapter 2. Basics of Program Writing

DR. A.P.J. ABDUL KALAM TECHNICAL UNIVERSITY LUCKNOW. Evaluation Scheme & Syllabus. For. B.Tech. First Year (Programming for Problem Solving)

Syllabus. ICS103: Computer Programming in C 2017 / 2018 First Semester (Term 171) INSTRUCTOR Office Phone Address Office Hours

IS12 - Introduction to Programming. Lecture 7: Introduction to C

C LANGUAGE AND ITS DIFFERENT TYPES OF FUNCTIONS

Room 3P16 Telephone: extension ~irjohnson/uqc146s1.html

The University of Aizu School of Computer Science and Engineering Introduction to Programming. Course Syllabus (Special Track for Foreign Students)

CSC231 C Tutorial Fall 2018 Introduction to C

EL2310 Scientific Programming

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

Arrays and Pointers. CSC209: Software Tools and Systems Programming (Winter 2019) Furkan Alaca & Paul Vrbik. University of Toronto Mississauga

CS 220: Introduction to Parallel Computing. Beginning C. Lecture 2

TDDB68 Concurrent Programming and Operating Systems. Lecture 2: Introduction to C programming

CMPT 115. C tutorial for students who took 111 in Java. University of Saskatchewan. Mark G. Eramian, Ian McQuillan CMPT 115 1/32

Hello, World! in C. Johann Myrkraverk Oskarsson October 23, The Quintessential Example Program 1. I Printing Text 2. II The Main Function 3

Computer Programming

C / C++ Coding Rules

CSE 303: Concepts and Tools for Software Development

Systems Programming Advanced Software Development

Course Administration

12. Debugging. Overview. COMP1917: Computing 1. Developing Programs. The Programming Cycle. Programming cycle. Do-it-yourself debugging

Beijing Jiaotong University CS-23: C++ Programming Summer, 2019 Course Syllabus

Work relative to other classes

Programming in C and Data Structures [15PCD13/23] 1. PROGRAMMING IN C AND DATA STRUCTURES [As per Choice Based Credit System (CBCS) scheme]

CSCI 2132: Software Development. Norbert Zeh. Faculty of Computer Science Dalhousie University. Introduction to C. Winter 2019

C Language, Token, Keywords, Constant, variable

High Performance Computing Lecture 1. Matthew Jacob Indian Institute of Science

Transcription:

COMP1917: Computing 1 1. Introduction Reading: Moffat, Chapter 1.

COMP1917 15s2 Introduction 1 Course Web Site http://www.cse.unsw.edu.au/~cs1917/15s2 Please check this Web Site regularly for updated information, including: Course Outline Notices Tutorial and Lab Exercises Assignments Style Guide Sample Programs Supplementary Material

COMP1917 15s2 Introduction 2 Textbook Recommended Text: Alistair Moffat, Programming, Problem Solving, and Abstraction with C, Pearson Educational, Australia, 2003. Reference Texts: Brian W. Kernighan and Dennis M. Ritchie, The C Programming Language, 2nd Edition, Prentice Hall, 1988. Jeri R. Hanly and Elliot B. Koffman, Problem Solving and Program Design in C, 7th Edition, Addison-Wesley, 2013. Paul Davies, The Indispensable Guide to C: With Engineering Applications, Addison-Wesley, 1995.

COMP1917 15s2 Introduction 3 Occupational Health and Safety (OHS) Computer Ergonomics and OHS for Students www.cse.unsw.edu.au/about-us/help-resources/for-students/ergonomics Other Resources for Students www.cse.unsw.edu.au/about-us/help-resources/for-students

COMP1917 15s2 Introduction 4 Plagiarism ALL work submitted for assessment (including labs and assignments, etc.) must be your own work Collaborative work in the form of think tanking is encouraged, but students are not allowed to derive code together as a group during such discussions Plagiarism detection software is used on submitted work See Yellow Form: www.cse.unsw.edu.au/people/studentoffice/policies/yellowform.html Unix Primer: http://newcse.cse.unsw.edu.au/help/doc/primer/primer.pdf CSE Addendum to UNSW Plagiarism policy: www.cse.unsw.edu.au/~chak/plagiarism/plagiarism-guide.html

COMP1917 15s2 Introduction 5 Planned Topics 1. Introduction 2. Numbers In, Numbers Out 3. Making Choices 4. Loops 5. Functions 6. Binary and Hexadecimal 7. Number Storage and Accuracy 8. Characters and Arrays 9. Pointers 10. Strings and Files 11. Writing a Makefile 12. Debugging 13. Structures 14. Linked Lists 15. Stacks and Queues 16. Binary Search Trees 17. Memory and Stack Frames 18. Machine Language 19. Sorting and Efficiency

COMP1917 15s2 Introduction 6 Old Lectures on YouTube Some of Richard Buckland s COMP1917 Lectures from previous Sessions are available onyoutube.com they are are not a requirement, but may be used as a supplementary resource, to see some of the topics presented from a different perspective syllabus was somewhat different, and topics were covered in a different order Search for COMP1917 UNSW

COMP1917 15s2 Introduction 7 Guiding Philosophy In this course we would like to: encourage the use of abstraction to solve problems. emphasise good documentation and coding practice. gain a general understanding of how a computer system works.

COMP1917 15s2 Introduction 8 Beyond COMP1917 This course provides you with the foundation necessary to deal with more complex concepts in: COMP1927: Computing 2 COMP2911: Engineering Design in Computing COMP2041: Software Construction COMP2121: Microprocessors and Interfacing

COMP1917 15s2 Introduction 9 Why C? good example of an imperative language many libraries and resources fast compilers provides low level access to machine widely used for writing operating systems and compilers, as well as industrial and scientific applications

COMP1917 15s2 Introduction 10 Brief History of C C and UNIX share a complex history. C was originally designed for and implemented on the UNIX operating system on a PDP-11 computer. Dennis Ritchie was the author of C (around 1971). In 1973, UNIX was rewritten in C. BCPL strongly influenced the C language. B (author: Ken Thompson, 1970) was the predecessor to C, but there was no A. The American National Standards Institute (ANSI) C standard was established in 1988, greatly improving source code portability.

COMP1917 15s2 Introduction 11 Getting Started: C Compilation one file C source code: file.c a.out (executable binary) To compilefile.c, you type the following: gcc file.c

COMP1917 15s2 Introduction 12 Getting Started: C Compilation many files C source code: file 1.c file 2.c file3.c gcc (compilation) Object files: file1.o file2.o file3.o gcc (linker) a.out (executable binary)

COMP1917 15s2 Introduction 13 Your First Program The traditional Hello World program. main( void ) { printf( "Hello, World!\n"); } Note: some changes will be needed, to make this code ANSI compliant.

COMP1917 15s2 Introduction 14 Compiling with gcc To compilehello.c, you type the following: gcc hello.c To run the program type:./a.out

COMP1917 15s2 Introduction 15 Command line Options with gcc The default withgcc is to compile your program uncritically, i.e. without giving you any warnings about potential problems. Good practice is to be tough on yourself: gcc -Wall hello.c The -Wall option tells gcc to report all warnings to anything it finds that is potentially wrong and non ANSI compliant. Storing the compiled program ina.out is not always helpful: gcc -o hello hello.c The-o option tellsgcc to place the compiled object file in the named file rather thana.out

COMP1917 15s2 Introduction 16 Compiling with dcc Tip: if you are having trouble tracking down some nasty bugs in your code, try compiling it with dcc instead of gcc. dcc does the same job as gcc, but it does more checking for memory overlaps, etc. and will (hopefully) help you to find and fix the nasty bugs.

COMP1917 15s2 Introduction 17 Breakdown of Hello World // include standard input/output library functions #include <stdio.h> int main( void ) // function and entry point { // library call to print string constant printf( "Hello, World!\n" ); } return 0; // tell OS that no error occurred

COMP1917 15s2 Introduction 18 Key Points Functions (subroutines) can be called anything except main, which is special. main is where the program starts executing. There must be one (and only one)main Functions can have parameters (printf) or no parameters (main). Curly brackets { } are used to enclose statements in a function. A function can be called by naming it in a statement. Each statement is terminated by a semicolon ;

COMP1917 15s2 Introduction 19 Key Points cont. Comments are denoted by // or with a pair of /* and */. // comments do not extend beyond the end of line. Comments between /* and */ can span multiple lines. Example: /* This is a library function that is defined in the header file stdio.h */ printf("hello World\n"); // this calls the function

COMP1917 15s2 Introduction 20 Basic Structure of a C Program // include files // global definitions // global variables // function prototypes // main function int main( ) { // local variables // other functions int f( int x ) { // local variables // body of function } // body of main function return 0; } return(... );