SaraBiz
asked on
quick syntax fix needed
There's something very wrong with this function...month and day aren't being changed, and I can't figure out why! Also, I'm trying to check for bad data (also wanted to check to see if its valid at all, but that didn't quite work). I put into /* to isolate the other problem, but I would like this fixed too.void getdata(int *month, int *day)
{
printf("Please enter the month and day in the format mm/dd.");
scanf("%d/%d", *month, *day);
/* while(*month>12||*month<1| |*day<1||* day>31)
{
printf("\nInput is incorrect. Please reenter:");
scanf("%d/%d", *month, *day);
} */
}
{
printf("Please enter the month and day in the format mm/dd.");
scanf("%d/%d", *month, *day);
/* while(*month>12||*month<1|
{
printf("\nInput is incorrect. Please reenter:");
scanf("%d/%d", *month, *day);
} */
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
int main(void)
{
int month=0, day=0;
getdata(&month, &day);
printf("%d, %d", month, day);
}