# Advanced C Programming

### Autumn 2016 :: ECE 264 :: Purdue University

This is for Fall 2016 (5 years ago)

# Syllabus

Prerequisites CS 15900 with a minimum grade of C-
Textbook Computer Science: A Structured Programming Approach Using C (3rd Edition) by Behrouz A. Forouzan (ISBN 9780534491321)

We will direct you to the appropriate sections of the book so that you can prepare for class and strengthen your understanding of concepts and practical issues. However, this course is about “Advanced C Programming” (a verb), not “The C Language” (a noun). As such, the foundation of your learning will come from practice. If you are good at finding resources online, you may be able to get through the course without purchasing the textbook, depending on your learning style. No assignments will directly depend your having access to the textbook.

Learning objectives This course is designed to ensure that every student who passes will have mastered the following learning objectives:
1. an ability to read and write C programs that use recursion
2. an ability to read and write C programs that use structures
3. an ability to read and write C programs that use dynamic data structures
4. an ability to read and write C programs that use files

These learning objectives form the backbone for the content in this course. However, they do not pose an additional requirement for passing. Grades are determined solely by the formula in the section below.

Course grades will be based primarily on homework (50%) and exams/quizzes (50%). In addition, you may earn extra credit through exemplary participation and/or bonus options on some homework assignments (if any). To determine your letter grade, we will calculate a summary score, S, as follows:
• S = H/2 + E/2 + P + B
• H = "average of the homework scores weighted by difficulty"; H ∈ [0, 100]
• E = 0.20*E1 + 0.25*E2 + 0.30*E3 + 0.25*Q; E ∈ [0, 100]
• Q = “quiz average” = 10*Average(Q1, Q2, …, Qn); Qi ∈ [0, 10]; Q ∈ [0, 100]
• E1 = “Midterm #1 score”; E1 ∈ [0, 100]
• E2 = “Midterm #2 score”; E2 ∈ [0, 100]
• E3 = “Final exam score”; E3 ∈ [0, 100]
• P = “participation score”; P ∈ [0, 10]
• B = “bonus score”; B ∈ [0, 10]
Your letter grade is then found according to the following correspondence: S ≥ 93 ⇒ A+,   S ≥ 90 ⇒ A,   S ≥ 87 ⇒ A–,   S ≥ 83 ⇒ B+,   S ≥ 80 ⇒ B,   S ≥ 77 ⇒ B–,   S ≥ 73 ⇒ C+,   S ≥ 70 ⇒ C,   S ≥ 67 ⇒ C–,   S ≥ 63 ⇒ D+,   S ≥ 60 ⇒ D,   S ≥ 57 ⇒ D–,   S ≥ 0 ⇒ F.
Clarification. Relative to the total:
• Midterm #1 is worth 10%.
• Midterm #2 is worth 12½%.
• Final is worth 15%.
• Quizzes together are worth 12½%. The number of quizzes is not preset. As an example, if we had 6 quizzes during the semester, then each would be worth ≈2%.
• Homework is worth 50% all together. Like quizzes, the number of assignments might change slightly. As of this writing, we are planning for a total of 15 assignments, which would make each worth 3⅓%, on average, but weighted by difficulty.
• Each participation point (including the homework bug bounty) is worth 1% of "extra credit" (not part of the denominator), up to an unlikely maximum of 10%. Most will be in the low end.
• Each bonus point (from assignments) is worth 1% of "extra credit".
This note was added 10/17/2016 but does not alter the policy.

Participation scores will be 0 by default. Points will be awarded to those who demonstrate exemplary engagement with the course content through (a) helping other students in online discussions, (b) asking insightful questions in class or instructor office hours, (c) being the first to report significant issues in homework assignments via the homework bug bounty, or (d) contributing to the class in other tangible ways.

Quizzes Quizzes may be given during any regular meeting of the class, with or without prior notice. You are responsible for attending every class, and staying current with the material covered so far.
Attendance

Students are expected to be present for every meeting of the classes in which they are enrolled. Only the instructor can excuse a student from a course requirement or responsibility. When conflicts or absences can be anticipated, such as for many University sponsored activities and religious observations, the student should inform the instructor of the situation as far in advance as possible…For unanticipated or emergency absences when advance notification to an instructor is not possible, the student should contact the instructor as soon as possible by email, or by contacting the main office that offers the course. When the student is unable to make direct contact with the instructor and is unable to leave word with the instructor’s department because of circumstances beyond the student’s control, and in cases of bereavement, the student or the student’s representative should contact the Office of the Dean of Students.

Bring the course reference sheet with you to every class.

Email The course staff are here to help you become a great C programmer. We will provide help with general questions during lab hours, instructor office hours, and via the course discussion board. Do not send general questions by email to the TAs or to the instructor. This is so students with similar questions can have the best chance at benefiting from your question and the answer. If we answer the same question repeatedly to different students, it takes time away from new, different questions, and also poses a risk that we might give slightly different answers and create confusion. General questions sent by email will either receive no reply or else a canned reply reminding you of this policy.

If you have questions of a personal nature that apply only to you, or require confidentiality, feel free to send email to the instructor, come to office hours, or schedule an appointment to speak at another time.

Homework

There will be approximately one programming assignment per week. To fetch the starter files (if any), you will run the command 264get hw05 (or likewise for the other assignments) from ecegrid.ecn.purdue.edu. To submit, you will type 264submit hw05 hw05.c (or likewise).

Late work. Deadlines are at 11:59:59 PM according to the clock on ecegrid.ecn.purdue.edu, unless otherwise announced. Due to the number of people taking the class, deadlines must be strictly enforced. Homework submitted up to 24 hours late will be subject to a penalty of 30% of the total possible points. 24-72 hours late will be subject to penalty of 50% of the total possible points. 72-120 hours late will be subject to a penalty of 70% of the total possible points.

Compiler warnings. Code that causes compiler warnings with compiled using gcc v6.1.0 (64-bit Linux) with the flags `-g -Wall -Wshadow -Wvla -std=c99`. on ecegrid will be subject to a penalty of 40% of the total possible points.

Memory errors. Code that contains memory problems reportable by Valgrind will be subject to a penalty of 40% of the total possible points.

Style. Code that violates the style guidelines listed in the course reference sheet may be subject to a penalty of 20% of the total possible points. (This may be checked by spot checking or automated means, for some, all, or none of the assignments, and for some, all, or none of the style rules.)

Automated testers. For some assignments, we may enable automated testing prior to submission, to give you some early warning if it seems that your own testing was inadequate. These do not take the place of your own testing, and will generally not show the full detail about what test failed. Also, they may not include every test that will be used to score submissions. We may add more later, if we discover flaws in some student submissions that were not covered by the tester. Your job is to meet the assignment specification.

Multiple submissions. Your score will be based on the maximum of the following:
• Score of latest submission as of the deadline.
• Score of latest submission as of 24 hours after the deadline, minus 30% of the points possible.
• Score of latest submission as of 72 hours after the deadline, minus 50% of the points possible.
• Score of latest submission as of 120 hours after the deadline, minus 70% of the points possible.
Exceptions may occasionally be announced by the instructor prior to the deadline, such as for assignments that are to be human-graded.

You are encouraged to submit as often as you wish, even if your solution is incomplete. Submitting an incomplete solution increases the chance of receiving some points, in case you run into trouble later on. Also, every submission is backed up, so that we can help you in case of a disaster.

Partial credit. Where practical, partial credit will be given for submissions that meet the base requirements (below), and pass some but not all of our tests.

Base requirements. The following requirements apply to all assignments (where applicable), and are in addition to the requirements given in the assignment description.

1. All required files must be included in a single submission.
2. All required files must be named exactly as specified in the assignment description.
3. Code can be compiled (as is) on ecegrid with gcc v6.1.0 (64-bit Linux) and the following parameters: `-g -Wall -Wshadow -Wvla -std=c99`.
4. Code can run on ecegrid well enough to be tested.
5. Code finishes in a reasonable amount of time (e.g., 2.0 seconds for most assignments)
6. Function signatures and data types match the specification in the assignment description
7. `main(…)` function does not have a return statement, or returns a value other than 0 or `EXIT_SUCCESS`.
8. Code follows our policy on academic integrity.

Any submission not meeting any of these eight base requirements will receive zero credit.

Homework bug bounty

Since we are creating new homework assignments, some issues are inevitable. Therefore, we are asking for your help in identifying issues with new assignments early.

The first person to find an report a significant issue—i.e., ambiguity, inconsistency, impossibility, or typos that substantially obscures the meaning—in a homework assignment will receive 1 participation point. Exceptionally insightful discoveries might receive 2 points.

You must post a message to blackboard with exactly this subject: "[possible issue in hw##]: description". The instructor reserves the right to determine what constitutes “significant”, “first”, and ”exceptionally insightful”, and to limit the number of points per person per assignment. In other words, please don't spam the board with philosophizing about the meaning of words or silly stuff, but if you find something that might confuse your classmates, call it out.

C language standard We are using the C99 (ISO/IEC 9899:1999) version of the C language, as compiled by gcc v6.1.0 (64-bit Linux) with the flags `-g -Wall -Wshadow -Wvla -std=c99`.
Regrades If we have made a mistake on the scoring of any assignment, quiz, or exam, please submit a regrade request form to the instructor within 7 calendar days of the date the score or feedback was returned to you. We will do our best to rectify any bona fide mistakes that are reported in this timeframe. Regrade requests are not an opportunity to negotiate grades or exceptions to policies. TAs are not authorized to discuss regrades.
Changes This syllabus is subject to change. In particular, homework contents, deadlines, and exam dates—may be changed without notice up to 1 week in advance. Homework weights may be adjusted at any time, to reflect the relative difficulty of the assignments. The grading scale cutoffs might be adjusted at any time, but any change between the beginning and end of the semester will be in students' favor. Other changes to course policies may be made to ensure the integrity of the course, to ensure fairness to students, or as otherwise deemed necessary by the instructor.
Exams

All exams and quizzes are closed-book, unless the instructor of your section announces otherwise.

The exams and/or quizzes of the two sections might be different. Although the learning objectives and most content will be the same, there may be some variation in timing, teaching style, and emphasis, making it more fair and effective to use separate exams. In that case, one might be open-book and the other closed-book. Listen in lecture and watch your email for announcements from your instructor.

The following procedures will be used to ensure the integrity and fairness of exams:

• Bring photo ID.
• Bathroom breaks are not allowed. Please go before the exam.
• Photographs or video recordings may be taken by course staff to document who was present.
• If you finish early and wish to leave, please be courteous and leave very quietly.
• The following items may be kept with you: pens, pencils, erasers (small, non-electronic), clear bottle of water with no label, analog watch (non-digital).
• The following items must be left ≥5 feet (1½ meters) away from you or any other student: bags, backpacks, purses, phone, laptop, smart watch, calculator, digital watch, any other student's exam.
• The following items are allowed for open-book exams, but prohibited for closed-book exams (i.e., must be left ≥5 feet from you or any other student): notes, reference sheet, textbook, other book(s).
• Summary:
open-book closed-book
pens, pencils, erasers (small, non-electronic)
clear bottle of water with no label
analog watch (not digital)
notes, reference sheet(s)
textbook, other book(s)
bags, backpacks, purses
phone, laptop, smart watch
calculator
digital watch
any other student's exam
* Items marked with "" must be left ≥5 feet (1½ meters) away from you or any other student.

### Electronic devices

Cell phones must be turned off or placed in silent mode—not vibate—in your bag ≥5 feet (1½ meters) from you or any student, or else left at home.

Using or looking at any electronic device during an exam may result in immediate ejection from the exam, even if there is no evidence that you were using it to cheat. This is because we cannot accurately determine what was on the device (or other item).

### Motivation

The vast majority of students at Purdue do their work honestly and with integrity. The value of their grades and their ultimate degree is based on the expectation that earning a good grade always requires learning the material well, and demonstrating that in a way that can be measured (e.g., exams and assignments). Those who cheat are eroding that value, the reputation of Purdue, and ultimately the value of your diploma.

Cheating is unfair to those who do their work honestly, and even to the few who do not. It defeats the purpose of being a student at Purdue. It also defeats our dual purpose as instructors in this course: (1) to teach you advanced C programming, and (2) to ensure that a good grade in ECE 264 is a dependable indicator of true proficiency in advanced C programming. If students are able to cheat, we have failed at both of those goals. For all of these reasons, we have a very strict stance against cheating.

### Definitions

For purposes of defining cheating for this course, the following definitions apply:

• “Copying” means reproducing any kind of data (including code, text, etc.) by any means (including copy-paste, copying files, hand-typing, etc.) from one source to another.
• “Trivial modifications” – include differences in whitespace, variable names, function order, or other changes that affect the appearance but not the function or intellectual content of the material.
• “Attribution” means explicitly acknowledging the source of copied content with a comment in exactly this format: /* Credit: <author>, <description>, <url_or_location> */.
• “Authorized sources” include:
• code that you have written yourself
• starter code for assignments retrieved using `264get`
• names of C standard library functions (e.g., `printf(…)`) and keywords (e.g., `#include`)
• any other source explicitly allowed by the instructor (with attribution).
• “Unauthorized sources” include any of the following (unless explicitly allowed):
• code from Stackoverflow, Wikipedia, or any other web site
• code from the textbook or any other book
• test cases given in assignment descriptions
• any other source that is not an authorized source
• “Unauthorized aid” means any resource that provides information or functionality relevant to a quiz or exam that was not explicitly allowed by the instructor. Unauthorized aids include:
• hidden note sheets (on a closed-book exam or quiz)
• other students' papers
• calculator
• watch
• any other resource not explicitly allowed
• “Cheating” includes doing—or attempting to do—any of the following:
• Copying any amount of code from another students' code, the web, a book, or any other unauthorized source, even if you change the variable names or rearrange expressions or lines of code. You may use code from the course reference sheet or code that you wrote yourself.
• Allowing another student to copy your code
• Using any resource on any quiz or exam that is not explicitly allowed
• Using unauthorized means to access exam contents.
• Using unauthorized means to alter or affect grades, submission timestamps, or submission contents, or anything else that might affect grades.

Be careful not to reveal your code to others inadvertently. It is your responsibility to log out when you leave, and guard any printed copies of your work. If we discover two assignment submissions that are identical or very similar, both may be penalized.

### Gray areas

Sharing abstract ideas about homework assignments—without code—is allowed, though we expect you to use good judgment. For example, standing together at a whiteboard and discussing a problem with spoken words and diagrams is allowed. Of course, in some cases sharing too much may deprive other students of the opportunity to learn and develop their problem-solving abilities. We leave this middle ground to your discretion.

Learning from code on the web or other sources is allowed, as long as you do not copy it by any means (including looking and typing it). Again, learning abstract ideas is allowed, though you should use good judgment to ensure that you learn how to solve programming problems.

Very generic code snippets (e.g., #include <stdio.h>) and the names of library functions should not require any copying. You should know those from memory.

### Penalties

Very minor instances (e.g., 1-3 lines of code from the web on a homework) will result in a score of zero for the affected assignment. All other instances will result in an "F" in the course, and a referral to the Office of Student Rights and Responsibilities.

### How to report cheating

We encourage you to report any cheating you see or hear about to the instructor. You may do so in person, by email, or anonymously (e.g., non-Purdue email address that does not identify you, note under door, etc.). In doing so, you will be improving the fairness for the entire class, while also teaching the individual(s) a valuable lesson.

Even if you do not wish to name an individual, we welcome any feedback you may have about how we can ensure fairness and integrity in this course.

Late registration

Students who register late must do all of the same assignments. If you register after any assignment is due, or less than 2 days before the deadline, you may request an extension by providing proof of the late registration to the instructor. The extension is not automatic.

Grief Absence Purdue University recognizes that a time of bereavement is very difficult for a student. The University therefore provides the following rights to students facing the loss of a family member through the Grief Absence Policy for Students (GAPS). GAPS Policy: Students will be excused for funeral leave and given the opportunity to earn equivalent credit and to demonstrate evidence of meeting the learning outcomes for misses assignments or assessments in the event of the death of a member of the student’s family.
Violent behavior Purdue University is committed to providing a safe and secure campus environment for members of the university community. Purdue strives to create an educational environment for students and a work environment for employees that promote educational and career goals. Violent Behavior impedes such goals. Therefore, Violent Behavior is prohibited in or on any University Facility or while participating in any university activity.
Disabilities

Purdue University is required to respond to the needs of the students with disabilities as outlined in both the Rehabilitation Act of 1973 and the Americans with Disabilities Act of 1990 through the provision of auxiliary aids and services that allow a student with a disability to fully access and participate in the programs, services, and activities at Purdue University.

If you have a disability that requires special academic accommodation, please make an appointment to speak with me during the first week of the semester in order to discuss any adjustments. It is important that we talk about this at the beginning of the semester. It is the student's responsibility to notify the Disability Resource Center of an impairment/condition that may require accommodations and/or classroom modifications.

Emergencies In the event of a major campus emergency, course requirements, deadlines and grading percentages are subject to changes that may be necessitated by a revised semester calendar or other circumstances beyond the instructor’s control. Relevant changes to this course will be posted onto the course website and/or sent by email to the Purdue email address (___@purdue.edu) of students registered in this course. You are expected to read your Purdue email on a frequent basis.
Nondiscrimination

Purdue University is committed to maintaining a community which recognizes and values the inherent worth and dignity of every person; fosters tolerance, sensitivity, understanding, and mutual respect among its members; and encourages each individual to strive to reach his or her own potential. In pursuit of its goal of academic excellence, the University seeks to develop and nurture diversity. The University believes that diversity among its many members strengthens the institution, stimulates creativity, promotes the exchange of ideas, and enriches campus life.

Purdue University prohibits discrimination against any member of the University community on the basis of race, religion, color, sex, age, national origin or ancestry, genetic information, marital status, parental status, sexual orientation, gender identity and expression, disability, or status as a veteran. The University will conduct its programs, services and activities consistent with applicable federal, state and local laws, regulations and orders and in conformance with the procedures and limitations as set forth in Executive Memorandum No. D-1, which provides specific contractual rights and remedies. Any student who believes they have been discriminated against may visit www.purdue.edu/report-hate to submit a complaint to the Office of Institutional Equity. Information may be reported anonymously.

Among the materials that may be protected by copyright law are the lectures, reference sheet, this web site, assignments, quizzes, exams, and other material presented in class or as part of the course. Always assume the materials presented by an instructor are protected by copyright unless the instructor has stated otherwise. Students enrolled in, and authorized visitors to, Purdue University courses are permitted to take notes, which they may use for individual/group study or for other non-commercial purposes reasonably arising from enrollment in the course during the semester in which the student was enrolled.

Notes taken in class are, however, generally considered to be “derivative works” of the instructor’s presentations and materials, and they are thus subject to the instructor’s copyright in such presentations and materials. No individual is permitted to sell or otherwise barter notes, either to other students or to any commercial concern, for a course without the express written permission of the course instructor. To obtain permission to sell or barter notes, the individual wishing to sell or barter the notes must be registered in the course or must be an approved visitor to the class. Course instructors may choose to grant or not grant such permission at their own discretion, and may require a review of the notes prior to their being sold or bartered. If they do grant such permission, they may revoke it at any time, if they so choose.

// Credit: A substantial portion of this policy document is derived from a template authored by the Purdue Center for Instructional Excellence.

// Credit: The regrade form is from Prof. Yung-Hsiang Lu.