Coursera
Explore
  • Browse
  • Search
  • For Enterprise
  • Log In
  • Sign Up

Interacting with the System and Managing Memory

OverviewSyllabusFAQsCreatorsPricing

HomeComputer ScienceSoftware Development

Interacting with the System and Managing Memory

Duke University

About this course: The final course in the specialization Introduction to Programming in C will teach you powerful new programming techniques for interacting with the user and the system and dynamically allocating memory. You will learn more sophisticated uses for pointers, such as strings and multidimensional arrays, as well as how to write programs that read and write files and take input from the user. Learning about dynamic memory allocation will allow your programs to perform complex tasks that will be applied in the final part of the specialization project: a Monte Carlo simulation for calculating poker hand probabilities.

Who is this class for: This course is for learners who have an interest in learning how to program, for people with no programming experience or for people with some experience who would like to gain solid fundamentals and a deeper understanding of how to program effectively.


Created by:  Duke University
Duke University

  • Andrew D. Hilton

    Taught by:  Andrew D. Hilton, Assistant Professor of the Practice

    Electrical and Computer Engineering

  • Anne Bracy

    Taught by:  Anne Bracy, Senior Lecturer

    Computer Science, Cornell University

  • Genevieve M. Lipp

    Taught by:  Genevieve M. Lipp, Adjunct Professor

    Electrical and Computer Engineering/Mechanical Engineering
Basic Info
Course 4 of 4 in the Introduction to Programming in C Specialization
LevelBeginner
Commitment4 weeks of study, 6–8 hours/week
Language
English
How To PassPass all graded assignments to complete the course.
Syllabus
WEEK 1
Module 1: Interacting with the user and system
So far, our programs have had a rather limited interaction with the user or rest of the system, printing some results to standard output (typically to the terminal). Now that we have learned about topics such as strings and arrays, we are ready to learn how to write a program that takes input from the user, takes arguments on the command line, accesses files, and does many other things we typically think of real programs as doing.
5 videos, 16 readings, 4 practice quizzes
  1. Video: Why We Need Interactivity and to Manage Memory
  2. Reading: Assignment 24_read_arr3
  3. Reading: Introduction to the Operating System
  4. Reading: Errors from System Calls
  5. Practice Quiz: The Operating System
  6. Reading: Command Line Arguments
  7. Reading: Complex Option Processing
  8. Reading: The Environment Pointer
  9. Reading: Process Creation
  10. Practice Quiz: Command Line Arguments and Process Creation
  11. Reading: Opening a File
  12. Reading: Reading a File
  13. Video: Reading a File with fgetc
  14. Practice Quiz: Opening Files and fgetc
  15. Reading: Reading a File with fgets
  16. Video: Reading a File with fgets
  17. Reading: Reading a File with fread
  18. Reading: Assignment 25_break_encr
  19. Reading: Writing to Files
  20. Video: Writing to a File
  21. Reading: Closing Files
  22. Video: Closing a File
  23. Reading: Other Interactions
  24. Practice Quiz: Writing and Closing Files
  25. Reading: Assignments 26_tests_matrix_input and 27_matrix_input
WEEK 2
Module 2: Dynamic allocation
So far, most of the memory we have used has been located on the stack. Dynamic memory allocation gives a programmer much more flexibility, in that it allows you to request a specific amount memory to be allocated on the heap, so that it will not disappear with the stack frame of the calling function.
7 videos, 19 readings, 5 practice quizzes
  1. Reading: Motivation for Dynamic Allocation
  2. Reading: malloc
  3. Video: Simple Call to malloc
  4. Reading: Fixing initArray
  5. Reading: More Complex Structures
  6. Reading: Shallow vs. Deep Copying
  7. Practice Quiz: malloc
  8. Reading: free
  9. Video: Mechanics of free
  10. Reading: Memory Leaks
  11. Video: Code with a Memory Leak
  12. Reading: A Dynamic Memory Allocation Analogy
  13. Reading: Common Problems with free
  14. Video: Three Common Problems When Using free
  15. Practice Quiz: free
  16. Reading: realloc
  17. Video: Call to realloc
  18. Practice Quiz: realloc
  19. Reading: getline
  20. Video: Reading a File with getline
  21. Video: Combining getline and realloc
  22. Practice Quiz: getline
  23. Reading: Valgrind's Memcheck
  24. Reading: Uninitialized Values
  25. Reading: Invalid Reads and Writes
  26. Reading: Valgrind with GDB
  27. Reading: Dynamic Allocation Issues
  28. Reading: memcheck.h
  29. Reading: Other Valgrind Tools
  30. Practice Quiz: Valgrind's Memcheck
  31. Reading: Assignments 28_fix_vg_encr, 29_outname, 30_sort_lines, and 31_minesweeper
WEEK 3
Module 3: Programming in the Large
So far, we have focused exclusively on programming in the small—designing the algorithm for a small-sized task, implementing it, testing it, and debugging it. This module discusses three main differences that "real" programs exhibit. 1) They tend to be much larger than those we have written. 2) More than one person works on them, sometimes teams of hundreds to thousands. 3) Real software has a long life-span during which it must be maintained. Now that you have an understanding of the basics of programming in the small, we are ready to begin learning about programming in the large!
2 videos, 21 readings, 2 practice quizzes
  1. Video: Introduction
  2. Reading: Analogy to Writing
  3. Reading: Abstraction
  4. Reading: The Seven-Item Limit
  5. Reading: Hierarchical Abstraction
  6. Practice Quiz: Abstraction
  7. Reading: Readability
  8. Reading: Function Size
  9. Reading: Naming
  10. Reading: Formatting
  11. Reading: Commenting and Documentation
  12. Practice Quiz: Readability
  13. Reading: Team Considerations
  14. Reading: Git
  15. Reading: Past Versions
  16. Reading: Collaboration
  17. Reading: Multiple Versions of the Present
  18. Reading: Read More
  19. Reading: Problem Description
  20. Video: Roster Planning
  21. Reading: Planning the High-Level Algorithm
  22. Reading: Writing and Testing readInput
  23. Reading: Finishing the Program
  24. Reading: Even Larger Programs
  25. Reading: Assignments 32_kvs, 33_counts, and 34_put_together
WEEK 4
Module 4: Poker Project
In this module, you will complete the Poker Project! Now that you know about dynamic memory allocation, user input, and how to program in the large, you can write the final parts of the program. You will write code to read in a file with a hand of cards and code to choose unknown cards from a shuffled deck. As you program with more sophisticated data structures, the importance of drawing good pictures will increase. Happy programming!
1 video, 1 reading
  1. Video: Poker Project: Final Part
  2. Reading: Poker Project: Final Part
Graded: Practice Programming Environment

FAQs
How It Works
Coursework
Coursework

Each course is like an interactive textbook, featuring pre-recorded videos, quizzes and projects.

Help from Your Peers
Help from Your Peers

Connect with thousands of other learners and debate ideas, discuss course material, and get help mastering concepts.

Certificates
Certificates

Earn official recognition for your work, and share your success with friends, colleagues, and employers.

Creators
Duke University
Duke University has about 13,000 undergraduate and graduate students and a world-class faculty helping to expand the frontiers of knowledge. The university has a strong commitment to applying knowledge in service to society, both near its North Carolina campus and around the world.
Pricing
Purchase Course
Access to course materials

Available

Access to graded materials

Available

Receive a final grade

Available

Earn a shareable Course Certificate

Available

Coursera
Coursera provides universal access to the world’s best education, partnering with top universities and organizations to offer courses online.
© 2018 Coursera Inc. All rights reserved.
Download on the App StoreGet it on Google Play
  • Coursera
  • About
  • Leadership
  • Careers
  • Catalog
  • Certificates
  • Degrees
  • For Business
  • For Government
  • Community
  • Partners
  • Mentors
  • Translators
  • Developers
  • Beta Testers
  • Connect
  • Blog
  • Facebook
  • LinkedIn
  • Twitter
  • Google+
  • Tech Blog
  • More
  • Terms
  • Privacy
  • Help
  • Accessibility
  • Press
  • Contact
  • Directory
  • Affiliates