David Notkin Autumn 2009 CSE303 Lecture 11 “Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration.”

Slides:



Advertisements
Similar presentations
Chapter 1 Introduction.
Advertisements

Introduction to C Programming
Chapter 7: Arrays In this chapter, you will learn about
C Language.
Lectures 10 & 11.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 16P. 1Winter Quarter Strings Lecture 16.
David Notkin Autumn 2009 CSE303 Lecture 13 This space for rent.
C Characters & Strings Character Review Character Handling Library Initialization String Conversion Functions String Handling Library Standard Input/Output.
1 Chapter 10 Strings and Pointers. 2 Introduction  String Constant  Example: printf(“Hello”); “Hello” : a string constant oA string constant is a series.
Character String Manipulation. Overview Character string functions sscanf() function snprintf() function.
Lecture 20 Arrays and Strings
What is a pointer? First of all, it is a variable, just like other variables you studied So it has type, storage etc. Difference: it can only store the.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 – Data Structures Characters and Strings.
EECS 690 February 26. Professions Just to clear up some word confusion: In common usage, a professional is generally anyone who gets paid to do something.
5/5/2015Software Engineering Code of Ethics1 Software Engineering Code of Ethics and Professional Practice Dr. Bob Weber CEG 460 / 660 Wright State University.
In the name of God Sharif University of Technology, International Branch, Kish Island Dr. Mohsen Sadighi Moshkenani Chapter 24.
Professionalism Professionalism takes more than knowledge
PROJECT MANAGEMENT ETHICS
Chapter 1- Ethics Lecture 2.
David Notkin Autumn 2009 CSE303 Lecture 10 "If it weren't for C, we'd be writing programs in BASI, PASAL, and OBOL."
Pointers Discussion 5 Section Housekeeping HW 1 Issues Array Issues Exam 1 Questions? Submitting on Time!
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 1 Slide 1 An Introduction to Software Engineering.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Chapter 9 Formatted Input/Output Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
Software Engineering Code Of Ethics And Professional Practice
1 Software Testing and Quality Assurance Lecture 35 – SWE 205 Course Objective: Basics of Programming Languages & Software Construction Techniques.
SE 112 Slide 1 SE 112 l
CSCE 431: Licensing and Software Engineering Code of Ethics
How the New Software Engineering Code of Ethics Affects You Vol. 1, Chapter 2, pp Presented by Naiana Campos University of Central Florida – EEL.
Ethics Lecture Dr. Christina Howe
Chapter 1 Introduction Yonsei University 2 nd Semester, 2014 Sanghyun Park.
ACM/IEEE Software Engineering Code of Ethics and Professional Practice
Strings in C. Strings are Character Arrays Strings in C are simply arrays of characters. – Example:char s [10]; This is a ten (10) element array that.
What is Software Engineering?. Software engineering Multi-person construction of multi-version software (David Parnas) An engineering discipline whose.
Introduction to Computer Science
Professional Ethics in Computing Dr. David Sinclair L253
1 Ethics The study of morality, that is, how do we tell the difference between a good action and a bad action; or how do we tell the difference between.
Ch. 101 Epilogue. Ch. 102 Outline What will be the future of the field? What is the impact of SE on society? What ethical issues are raised by SE?
Professional Ethics: Should Software Engineers Adhere to a Professional Code of Conduct? Jonathan Schiff CS 301.
S OFTWARE E NGINEERING C ODE O F E THICS A ND P ROFESSIONAL P RACTICE Software Engineering Ethics and Professional Practices © 1999 by the Institute of.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 1 Slide 1 Software Engineering The first lecture.
Therac-25 Case Family vs. Programmer. People Suffered From Different Type of Bad Programming Database accuracy problems. Many people could not vote in.
©Ian Sommerville 2000Software Engineering, 6th edition. Chapter 1 Slide 1 Chapter 1 Introduction.
File IO and command line input CSE 2451 Rong Shi.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 1 Slide 1 Professional and ethical responsibility l Software engineering involves wider.
1 These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill 2009). Slides copyright 2009 by Roger Pressman.
ICS131 – Ethics 11/17/03. IEEE-CS and ACM 1.PUBLIC - Software engineers shall act consistently with the public.
Lecture 22: Reviews for Exam 2. Functions Arrays Pointers Strings C Files.
ACM/IEEE SWEngineering Code of Ethics and Professional Practice Appendix A, p 467.
Computer Organization and Design Pointers, Arrays and Strings in C Montek Singh Sep 18, 2015 Lab 5 supplement.
1 Software Engineering, 8th edition. Chapter 1 Jan 28 th, 2009 Lecture # 1 Courtesy: ©Ian Sommerville 2006 An Introduction to Software Engineering.
Why? Software Engineers don’t communicate very well…
1 CSC 4700 Software Engineering John Lewis These slides are based on originals provided by Ian Sommerville.
CS 1704 Introduction to Data Structures and Software Engineering.
Ethics and Computer Science Most of the material for these lectures was taken from an EXCELLENT text on the subject: Ethics for the Information Age Michael.
IT depends on several codes of ethics 1. PUBLIC - IT engineers shall act consistently with the public interest. 2. CLIENT AND EMPLOYER - IT engineers shall.
1 A Mature Profession Of Software Engineering A Mature Profession Of Software Engineering Ye Yint Win EC Member (Myanmar Computer Scientist Association)
School of Business Administration Chap 3 Engineering of Software;
Dr. Rob Hasker Dr. Brad Dennis. Sony’s Virus  2005: Sony wanted to reduce piracy  They put an XCP program on 20 CDs including Van Zant, The Bad Plus,
School of Business Administration Chap 3 Engineering of Software;

INTRODUCTION TO SOFTWARE ENGINEERING
Computer Organization and Design Pointers, Arrays and Strings in C
An Introduction to Software Engineering
User-Written Functions
Software Engineering Introduction.
CSCE 606: Licensing and Software Engineering Code of Ethics
CSCE 606: Licensing and Software Engineering Code of Ethics
Bill Tomlinson Art and computing Effects of computer-based art on society? (e.g. animation) Effects of participatory experiences on group dynamics.
Code of Ethics - History
Presentation transcript:

David Notkin Autumn 2009 CSE303 Lecture 11 “Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration.” Stan Kelly-Bootle

Upcoming schedule CSE303 Au092 Today 10/23 Monday 10/26 Wednesday 10/28 Friday 10/30 Monday 11/2 Finish-up Wednesday Some specifics for HW3 Social implications Friday Memory managementMidterm review Midterm

Wednesday: after class question Paraphrase: “If I overwrite memory outside the bounds of my process, can I hurt other processes or my computer?” No, you can’t Indeed, although you can do almost anything within your process – and can make your life miserable doing so – Unix keeps everything you do within your own process (well, close enough) Indeed, that’s why you get a segfault if you access memory outside of your virtual address space So, you can destroy your process, but other processes and your computer remain safe CSE303 Au093

Pointer: a memory address referring to another value

Dereferencing: access the memory referred to by a pointer *pointer // dereference *pointer = value; // dereference/assign int x = 42; int* p; p = &x; // p stores address of x *p = 99; // go to the int p refers to; set to 99 printf("x is %d\n", x); Output: x is 99

* vs. & many students get * and & mixed up –& references (ampersand gets an address) –* dereferences(star follows a pointer) int x = 42; int* y = &x; printf("x is %d \n", x); // x is 42 printf("&x is %p\n", &x); // &x is 0x0022ff8c printf("y is %p\n", y); // y is 0x0022ff8c printf("*y is %d \n", *y); // *y is 42 printf("&y is %p\n", &y); // &y is 0x0022ff88 What is *x ?

L-values and R-values L-value: Suitable for being on left-side of an = assignment -- a valid memory address to store into R-value: Suitable for right-side of an = assignment int x = 42; int* p = &x; L-values : x or *p (store into x ), p (changes what p points to) not &x, &p, *x, *(*p), *12 R-values : x or *p, &x or p, &p not &(&p), &42

Pass-by-value: copy parameters' values Cannot change the original (“actual”) parameter variable int main(void) { int a = 42, b = -7; swap(a, b); printf("a = %d, b = %d\n", a, b); return 0; } void swap(int a, int b) { int temp = a; a = b; b = temp; }

Pass-by-reference: point to parameters Can change the actual parameter variable using the “formal” int main(void) { int a = 42, b = -7; swap(a, b); printf("a = %d, b = %d\n", a, b); return 0; } void swap(int a, int b) { int temp = a; a = b; b = temp; }

#1 to know for HW3: arguments to main #include int main(int argc, char *argv[]) { printf("%s#%d#%d\n", argv[1] // print 1 st argument as string strlen(argv[1]), // show it’s a string atoi(argv[1])+1); // convert it to an int } $ a.out #3#547 $ CSE303 Au0910

#2 to know for HW3 printf("%4d%2d%3.1f%\n”…) Printing fixed-width field Printing fixed number of decimal places Printing % CSE303 Au0911

#3 to know for HW3 Input functions to consider (depending on your approach) –scanf – read and convert values –getchar – read next character Depending on your approach, you may need to convert among data types [I didn’t need any of these, except for one atoi ] –atoi – ascii to int –sscanf – same as scanf, but from a string instead of a file (stream) –sprintf – same as printf, but into a string instead of to a file (stream) CSE303 Au0912

#4 to know for HW3 How to handle reaaallllllllllllllyyyyyyyyyyyyyyy long integer entries? Hint: think about the whole problem – not just how to handle input – before you code – it can be easier than you think, unless you don’t think about it CSE303 Au0913

Ethics Definition? CSE303 Au0914 “the rules of conduct recognized in respect to a particular class of human actions or a particular group, culture, etc.” ethics. Dictionary.com. The American Heritage® Dictionary of the English Language, Fourth Edition. Houghton Mifflin Company, (accessed: October 23, 2009).

Codes of ethics -- just two categories in their lists arehttp://ethics.iit.edu/ –Sports and Athletics American Football Coaches Association Australian Sports Commission Canadian Curling Association Canadian Soccer Association Club Cycliste Baconsfield National Association of Sports Officials National Basketball Association United States Olympic Committee –Fraternal Social Organizations Brookline Bird Club Gamma Beta Phi National Speleogical Society Universal Autograph Collectors Club CSE303 Au0915

Why have codes of ethics? Aren’t laws enough? Isn’t personal commitment enough? Aren’t company policies enough? … CSE303 Au0916

Why have engineering codes of ethics? And why have software engineering codes of ethics? CSE303 Au0917

Software Engineering Code of Ethics and Professional Practice [short version] In accordance with their commitment to the health, safety, and welfare of the public, software engineers shall adhere to the following eight Principles: 1.Public. Software engineers shall act consistently with the public interest. 2.Client and employer. Software engineers shall act in a manner that is in the best interests of their client and employer, consistent with the public interest. 3.Product. Software engineers shall ensure that their products and related modifications meet the highest professional standards possible. 4.Judgment. Software engineers shall maintain integrity and independence in their professional judgment. 5.Management. Software engineering managers and leaders shall subscribe to and promote an ethical approach to the management of software development and maintenance. 6.Profession. Software engineers shall advance the integrity and reputation of the profession consistent with the public interest. 7.Colleagues. Software engineers shall be fair to and supportive of thei colleagues. 8.Self. Software engineers shall participate in lifelong learning regarding the practice of their profession and shall promote an ethical approach to the practice of the profession. CSE303 Au0918

Questions? CSE303 Au0919