I've tried to correct my program given the information you provided, Arkm.
1. that redundant right brace was my bad for putting in in the first place. It belonged to the main() function.
2. I would think (input, limit) does eat 7, since it's 0-6, making 7 elements, and I defined input to be of 7...