It continuously prints 2147483647 as the last number of the haystack, even when I use a different seed or no seed at all. Does anyone know why?


I will wager that it is printing past the end of the array. Let's assume that there are n numbers to be printed. Does your for loop look something like for(int i = 0; i<=n; i++) particularly the <= in the test condition? In other words, are you trying to print array[n]? Remember, the array runs from element 0 to element n-1.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

If not, please edit the question, and add some code. Everyone's crystal balls are in the shop. ;-D

| improve this answer | |

You must log in to answer this question.

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