Thru this website I did away with empty constants, but i need someone to review this program and offer some insight. Run does not give the expected response.
Code:
#include <stdlib.h>
#include <stdio.h>
#define MAXCHARS 20
void seperate(char *, char*, int*);
int main()
{
char date[MAXCHARS];
char tempmonth[MAXCHARS];
int tempday;
printf("\nPlease enter month and day(for example, June 14):");
gets(date);
seperate(date,tempmonth,&tempday);
printf("\nSeperated date: %d\n",tempday);
printf("\nSeperated month: %d\n",tempmonth);
system("PAUSE");
return 0;
}
void seperate(char*date, char*month, int*day)
{
int index;
for(index=0; date[index] != '\0'; index++)
{
month[index]=date[index];
}
month[index]='\0';
*day = atoi(date+index);
}