Description
The purpose of this lab is to practice using pointers and dynamic memory allocation and to learn to use the valgrind tool.
To start, login to MarkUs and navigate to the lab3 assignment. Like the previous lab, this triggers the starter code for this lab to be committed to your repository.
Your first program will build a dynamic array containing the first n elements of the fibonacci sequence. Write the fibonacci function in the fibonacci.c file. Do not change the main function.
In the split_array.c program, you will write the bodies of two functions. You will need to fill in the arguments to correctly call the two functions so that your program behaves as shown in the following examples.
Here are a couple of things to notice:
$ is just the shell prompt
argv[0] is not included in the result arrays.
$ ./split_array 1 2 3
Original array:
1 2 3
result[0]:
-
3
result[1]:
$ ./split_array 1 Original array:
result[0]:
result[1]:
$ ./split_array
Original array:
result[0]:
result[1]:
第2页 共2页 2019/3/23 14:07