Needed some help getting this program to work correctly. The object of the program is to have a user input a string for a date and then call a function to extract that date into two variables (month, day) and reprint the information. Not quite sure what I am doing wrong but it compiles and when I enter a date it comes back with the date is 4, 4254512. Any help would be greatly appreciated.
I think the problem is probably in the function in the way of I am having trouble trying to figure out how to input a string and send two variables back to the main program. I am sure it is a simple solution that I cant figure out.
Thanks
Kevin
#include <stdio.h>
void seperate(char[]);
char date[6];
char month;
int day;
int main()
{
month = 0;
day = 0;
printf("Please input a month and date (i.e. JUN 10, MAY 22)\n\n");
gets(date);
seperate(date);
printf("\n\nThe date you entered is %c, %d",&month, &day);
return 0;
}
void seperate(month, day)
{
sscanf(date, "%c %d",&month,&day);
return;
}



LinkBack URL
About LinkBacks


