Any idea why this loop repeats regardless of the input? What I have there does correctly assign the proper values to month, day, and year, but the input prompt is repeated no matter what is input. Obviously I would like it to repeat if an impossible day < 1 or > 31 is input, and also do the same for month and year which I'll add after I get this working.

while(day > 31 || day < 1)
{
printf("Please Enter the Check Date (Format: 01/01/1981): ");
scanf("%s", s);

int month = strtol(s, &ptr, 10);
int day = strtol(++ptr, &ptr, 10);
int year = strtol(++ptr, &ptr, 10);
}

One thing that I see here is that it looks like its trying to make a new int everytime it loops. Try defining your variables before the while statement.

Thanks ... Erasing the int in front of those was all it needed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.