View Single Post
Old 10-03-2014, 12:58 AM   #15
Question the trends!
REACTOR's Avatar
Join Date: Apr 2011
Location: Malaysia
Posts: 1,162
Default Re: Problem: Functions In C

Originally Posted by seamonkey View Post
Some things:
s_ei_it.c doesn't return anything. Your description at the top says it does. (hence it being void)

In the same file you run into some problems at your if statement. The first problem is that you validate the number ilimit, and it is excluded in your if statement, meaning it wouldn't get stored, and the program would ask the user for the same day again. I don't think you want a special case for when ilimit is entered.

The other problem with this if statement is that (assuming you don't want the program to just ask the user for another number on the same day when ilimit is entered), the if statement is totally unnecessary. The if statement's condition is otherwise ensured as true because the if loop's condition is the exact opposite of the while loop's condition.

Lastly the idx/idx2 variable stuff is confusing and annoying. It would be really good if you literally just put idx + 1 in your printf statement and the final statement and just eliminate idx2. (and put idx in the larger while loop condition and remove the = of course)
Well thanks for your reply! I managed to fix my function, and also any other problems that cropped up along the way. YAY!! XD

Though, I do intend to keep idx2, if the final result is bug free, than what's the diff?
REACTOR is offline   Reply With Quote