| HenryLewis91 (5) | |||
|
When I enter "1" as the input for num_movies my code exits. Any ideas why? ~Henry
| |||
|
Last edited on
|
|||
| HellfireXP (71) | |
I changed this... time_read(arr, i, movie);to this... time_read(arr, num_movies, movie);and it worked for me with just 1 movie... but multiple movies were off... so you might need to relook what's going on in the time_read() function. | |
|
|
|
| MikeyBoy (235) | |
|
Henry, It exits because you're initialising i to 0 in your main function, and then passing it into time_read(). In time_read, your loop condition is (j < i). If i is 0, and you initialise j to 0, then j is never less than i. This means that the body of your for loop won't be executed. This also means that no matter what number you put in for num_movies, the first time you call time_read(), it will do nothing, because the first time it is called, i is 0. Why do you need two loops? You have a while loop in main and a for loop in time_read(). What's the purpose of that? | |
|
|
|