View Single Post
Old 10-02-2014, 09:32 AM   #14
spoon eater
seamonkey's Avatar
Join Date: Oct 2007
Location: the question is where are you?
Posts: 1,616
Default Re: Problem: Functions In C

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'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)
French fry Kremlin the morose nucleotides!-Jamul
There is no fifth amendment in mafia games - you don't have a right to be silent!- hammered
"So tell me Harry, what exactly is the purpose of a rubber duck?" -Mr. Weasly

Last edited by seamonkey; 10-03-2014 at 02:14 PM.
seamonkey is offline   Reply With Quote