I think I've finished find.c
, but I'm not quite sure how to check it. For example, one of the things it must do is find 42
in {42, 43, 44}
, so how do I enter this into the terminal window? Do I use generate and find, or just find? I've tried a few different ways that don't seem to be working.
1 Answer
You can test find
by itself. generate
is used to create a set of numbers to test with, to save you having to manually enter the numbers each time, and it is not required to test find
.
find
implements a specific input behaviour pattern. As long as you have not modified find.c
in any way you should be able to pass the value you want to search for (the needle), on the command line, like so:
./find 42
find
should then prompt you to start entering the list of numbers that you want to search in (the haystack). Enter each number at the prompt:
42
enter
43
enter
44
enter
When you have entered the last number, hit CTRL+D to tell find
to stop asking for numbers and start the search.
check50...
command mentioned on the pset3 page. It checks everything and gives you feedback.