1 of 11

CSC209 Tutorial Three

Arrays and pointers continued, dynamic memory, command line arguments, valgrind

Slides created by Daniel Laufer and Meghan Torchia

2 of 11

Valgrind

2

  • Valgrind is a set of tools for debugging and profiling code.
  • It can be used to find errors, to detect vulnerabilities, and to optimize performance.
    • For example: finding memory leaks in your program.

3 of 11

Valgrind Example

3

Output from running valgrind --leak-check=yes -v ./a.out

“a.out” is just the name of the executable in this example

4 of 11

Additional Questions

5 of 11

CSC209 2017 Final Exam Question 2a

6 of 11

CSC209 2017 Final Exam Question 2d

7 of 11

CSC209 2017 Final Exam Question 2e

8 of 11

CSC209 2017 Final Exam Question 2f

9 of 11

Let’s work on some questions

Lab code can be found in the ‘lab code’ link under week 3’s content on the course website.

10 of 11

Anonymous Feedback/suggestion

Form

10

  • Is there anything specific you’d like us to cover in next week’s tutorial?
  • Is there anything you’d like to change about these tutorials?
  • Let us know!

11 of 11

Thanks for coming!