0

please, I'm lost what to do next, after coding search and sort. what do i have to do to change haystack [] ?Do I have to change code in generate ? in find ? both ? is it something I have to add in search and sort ? please help me. When I enter ./find 42 I should have : ./find 42 50 43 ^d Didn't find needle in haystack. but what I have is `haystack[0] = 50

haystack[1] = 42

haystack[2] =

Didn't find needle in haystack.And when I test my code with ./generate 1000 50 | ./find 127 I just get a 1000 list of haystack without numbers with a negative answer :haystack[0] = haystack[1] = haystack[2] = haystack[3] = haystack[4] = haystack[5] = haystack[6] = haystack[7] = haystack[8] = haystack[9] = haystack[10] =

Didn't find needle in haystack.

1 Answer 1

1

You do not have to (even are not allowed to) change find and generate. Most probably, in you sort function you do something wrong with haystack.

Run debug50 with ./ find 42; 50, 43 and look at your few variables inside sort.

13
  • thank you, I did debug50 ./find 42. But what it s means to delete ./find ? do I have to do make find when I'm done writing the code ? I think there a step that I'm missing. Here is the message I have : WARNING: Could not set any breakpoints. Try deleting ./find and re-compiling your code. Be sure to compile with -ggdb3. haystack[0] =
    – Genevie
    Jul 7, 2017 at 14:16
  • I have written that n : no value ??
    – Genevie
    Jul 7, 2017 at 14:19
  • I did ''make find''. Rerun debug50 ./find 42 and same result ?
    – Genevie
    Jul 7, 2017 at 14:31
  • I'm lost a bit. Have you managed to deal with debug50? have you solved the issue?
    – obesman
    Jul 7, 2017 at 14:34
  • thanks for being here helping. I did : ~/workspace/pset3/find/ $ debug50 ./find 42 WARNING: Could not set any breakpoints. Try deleting ./find and re-compiling your code. Be sure to compile with -ggdb3. So I went to check, and I needed to do ''make find'' which compiling find works. And I retype debug50 and still the same answer. I don't know how to use debug50 correctly, I mean, I m reading that I have to choose a function ? what's the -ggdb3 ?
    – Genevie
    Jul 7, 2017 at 14:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .