In this activity, you will execute files with errors, with
Valgrind. These files are under your repository in the
Valgrind_errors
directory. There is a local copy
here.
For each of the following
files, compile it with the -g directive (that is
gcc -Wall -g yourfile.c -o yourexecutable), execute it
with Valgrind (valgrind --leak-check=yes
./yourexecutable), and fix the reported errors, explaining in the
same file (with a comment of 1-2 lines) the reason for the error:
File strcpy_exercise.c
: copies one
string over a second one.
File printing_exercise.c
: copies an
integer to a pointer and prints its address and the value just
copied.
Opcionalmente, upload the modified files to your repository and show the modifications to the teacher to be evaluated.