of 26 /26
C Programming MTRX 1702 – Software Component 06/06/22 1 Introduction

Introduction to String matching

Embed Size (px)

Text of Introduction to String matching

C ProgrammingMTRX 1702 Software Component

7/24/2012

Introduction

1

Who am I? Dr David K Wood Australian Centre for Field Robotics (ACFR) Room: ACFR field Lab, Ground Floor, EE Building Availability: Limited outside of lectures. Phone: 90366398 Email: [email protected]

Graduate of USYD Mx Degree (2005)7/24/2012 Introduction 2

Lectures and Labs Lectures: Wednesday 12-13 (Civil Eng LR3)

Labs: 2 hours per week Wednesday 2-4 Thursday 2-4 Friday 9-11

NO LAB CHANGES! If you really need something changed, come see me after the lecture

7/24/2012

Introduction

3

Tutors Lachlan McCalman [email protected] Nasir Ahsan [email protected] Me - Wednesday [email protected]

7/24/2012

Introduction

4

TextbooksPrescribed Textbooks: Bailey, T. An Introductory Course on C Programming and Software DesignThis text is by an earlier lecturer for this course, and still follows the lecture schedule quite well. It is available online at:

www-personal.acfr.usyd.edu.au/tbailey/ctext Deitel, H.M. and Deitel, P.J., C: How to Program. 3rd Ed.An alternative introductory textbook. Very simple. Many code examples.

Recommended Textbooks: Harbison, S.P. and Steele G.L., C: A Reference ManualOne of the definitive reference handbooks. Not a learning textbook.

Oualline, S. Practical C ProgrammingAn alternative introductory textbook. Simpler than K&R. Quite good.

Kernighan, B.W. & Ritchie, D.M. The C Programming Language. 2nd Ed.The textbook you will probably turn to as you gain experience. Written by the creator of C (Ritchie), it is authoritative and complete.

7/24/2012

Introduction

5

Other Resources It is highly recommended to get a compiler and development environment for home Visual Studio Real version is large, expensive and under-utilised Other versions are insecure and unreliable! Express Edition is FREE from the MS website, and has the same functionality as the laboratory machines.

Other Dev Environments If youve used something before, feel free to use it again. All marking will be on V.S. 20107/24/2012 Introduction 6

7/24/2012

Introduction

7

Course Information Course material accessible from AMME website.www.aeromech.usyd.edu.au/MTRX1702/Course_Material/

Look at the software engineering component for: Lecture slides Lab material Assignments On-line resources News

7/24/2012

Introduction

8

Class Diversity I expect a wide range of diversity regarding familiarity with programming concepts and C. Some will be quite proficient. Some will be complete novices.

We have a lot to cover in this course and will move quickly. Everything you need to know will be explained in lectures and labs, but you will need to work hard to keep up.

Please ask questions if there is anything you dont understand. If you dont ask, I wont know that you dont know.

Remember that many aspects of programming will become clearer by looking at example code and doing the labs.

7/24/2012

Introduction

9

Feedback Please provide feedback Problems with course material or presentation Problems with labs Constructive criticism (or praise)

Do so by sending me an email If you want something fixed or desire some modification of the course, let me know sooner rather than later

7/24/2012

Introduction

10

My ExpectationsBy undertaking this subject, the student is committing to: Learn the subject, not just memorize notes. Attend all lectures, with the aim of learning and understanding, not just note taking. Attend all laboratory sessions, with the aim of maximizing your understanding of the course material. Study this topic for at least 1 hour per week outside of allocated class time. Being familiar with, and adhering to the Universitys policies, in particular the policy on academic honesty.7/24/2012 Introduction 11

What You Can Expect I am willing to help anybody that has attempted to first help themselves I do not give out answers, I help you to understand the problem You are free to ask questions at any time here in the lectures, in the labs, or via email Let me know immediately if things are not going well and we will attempt to resolve any issue.

7/24/2012

Introduction

12

How to Do Well Attend lectures and labs. Read the lecture notes. Read ahead and come to class prepared. Read the lab sheet in advance. Work through lab questions in the allotted time. Ask questions if you dont understand. Keep up to date.

Experiment with writing and debugging code during labs. This is an essential part of gaining an understanding of the C language and its use.

Submit assignments that are neatly presented and on time.7/24/2012 Introduction 13

Assessment Lab Attendance (5%) Two Assignments (50%) Two-hour Exam (45%) Each week (starting in Week 2) lab-work is given. Attending and participating in labs is compulsory. Understanding code and writing programs is the only way to learn to program. This is not a course that you can cram in stu-vac.

Experiment with code-modules during labs. Use the debugger. Work through the labs and lectures, and the exam will be simple!

7/24/2012

Introduction

14

Why Learn C?After all, C is over 30 years old. There are other newer languages now. 1. 2. 3. 4. 5. 6. C will be the language used in several later courses. C compilers exist for almost all platforms, so your code can be readily ported and run anywhere. C is high-level, yet close to the machine. So, it is commonly used in embedded programming. C remains the language of choice in many other areas also. For example, systems programming, graphics, numerics, real-time control, etc. Thus, it means real jobs. There exists a huge base of existing C code that must be maintained. Again, real jobs. There exists a huge number of open-source libraries for C. This code is often of excellent quality and can be used directly in your project.Introduction 15

7/24/2012

Course Objectives Introduce the C programming language as a practical programming tool. Introduce the basic concepts of software design. Learn to design, code, and debug complete C programs. Learn how to decompose large problems into manageable systems of modules. Design for correctness, flexibility, extensibility, maintainability.

7/24/2012

Introduction

16

Where will you have trouble? Well discuss that in weeks time. We have 13 1-hour lectures interspersed with labs Make good use of Textbooks Dont try to understand everything at once

How do I solve ? The first 2 labs are designed to familiarise you with the environment. TAKE NOTES! A Lab-book is highly recommended. Check back on your own material before you ask the tutors.7/24/2012 Introduction 17

Brief History of ANSI/ISO C C pioneered by Dennis Ritchie at AT&T Bell Labs, early 70s Most early C compilers based on an appendix in the 1st Edition of Kernighan & Ritchie so called K&R C. K&R C has some unspecified details: it is has aspects that are ambiguous and incomplete. Many incompatible dialects of C were appearing, hindering portability. ANSI committee X3J11 formed in 1983 to standardise C; they reported in 1989. International ISO standard in 1990. See paper by Ritchie (1993) for more information on the history and philosophy of C. The ISO standard was revised in 1999 giving us C99.7/24/2012 Introduction 18

C Language Overview General purpose language: used for writing software in many different domains (compilers, graphics, games, embedded systems, etc) A small language - 32 keywords With a small level of experience, can expect to know, and regularly use, the entire language. Provides modern high-level control constructs: decisions, loops, functions. Provides low-level capabilities: manipulate characters (bytes) and addresses.

7/24/2012

Introduction

19

How can the Language be so Small? It relies on library functions: no operations that deal directly with composite objects (e.g. strings, lists, arrays, matrices, collections) no memory management facilities (apart from static definition and stack allocation). no input or output facilities (eg, print to the screen, write to a file, etc)

These operations require explicitly called functions. eg, many languages provide a keyword to print to the screen (eg, Fortran has a PRINT instruction). The C language has no such keyword, and we use the standard library function printf() to print.

C comes with a standard library that provides a collection of commonly used functions (145 of them). All C programs are composed of functions, and we will cover functions extensively in this course.

7/24/2012

Introduction

20

Some Example Programs hello.c: a traditional first program hello2.c tempf.c tempf2.c

#include int main(void) { printf("Hello, world!\n"); /* Print Hello World to screen */ return 0; /* Return Success */ }

7/24/2012

Introduction

21

How does C work?

7/24/2012

Introduction

22

What does that actually mean?My Code Script Engine Operating SystemHardware

Scripting Languages require the script engine to be installed: MATLAB Java Python

Cannot run without additional infrastructure.7/24/2012 Introduction 23

Get rid of the EngineMy Code My Program Operating SystemHardware

Instead of executing our code within a scripting engine, we compile to an executable. Two major savings:1. Efficiency Compile happens before runtime 2. Portability No longer need engine

7/24/2012

Introduction

24

Why stop there???My Code My ProgramHardware

Get rid of the operating system altogether My program directly interfaces to the hardware and thus to the real world! Common in embedded systems. MTRX2700, MTRX3700, MTRX4730 and your own hobby work7/24/2012 Introduction 25

Homework Get a copy of the lecture notes off the web. Review chapters 1 and 2 of lecture notes. (Today's lecture and next lecture) Decide on and purchase a textbook. Look into getting some sort of development environment on a home/personal computer. Lecture notes contain many small code snippets. These might be more understandable as complete working programs, which, for Chapters 1 3, can be found on the textbook webpage.7/24/2012 Introduction 26