0

I don't understand exactly how the find.c function works. The problem set site says to give this input:

./generate 1000 50 | ./find 127

In the finder.c code, it takes the needle from: atoi(argv[1]). Does C some how know to extract 127 from this code?

Then, it is not clear to me where the generate function is called in the code?

1 Answer 1

1

I do not know if I understand the question well, the program ./find works as expected, on the line:

./generate 1000 50 | ./find 127

127 is argv [1], in the ./find program, as well as 1000 and 50, are argv[1] and argv[2] in the ./generate program.

the command line tell us:

"| (piping) --- Lets you execute any number of commands in a sequence. The second command will be executed once the first is done, and so forth, using the previous command's output as input"

I hope this help

1
  • Thanks I think that clears it up. Piping is a bit unclear to me, though hopefully I will get a better grasp throughout the course
    – Haim
    Commented May 7, 2017 at 19:18

You must log in to answer this question.

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