I want to reinitialize a structured variable.
void menu( char *fname)
{
int option;
int totEntries = 0;
DiaryType Diary;
.....
case 1: doCreate(&Diary) ; break;
.....
}
int doCreate(DiaryType *Diary )
{
char year[5] ;
char fname[ MAX_FNAME ] ;
char owner[MAX_OWNER + 1];
char yn ;
FILE *fp ;
if(Diary->fname[0]!='\0')
{
printf("A file is already open. Close the file(Y/N): "
rewind(stdin);
yn=getc(stdin);
if(yn=='Y' || yn =='y'){
doExit(Diary) ;
menu(fname) ; <======= I am going back to the menu function to get rid of the old values stored in the Diary structure. Is there any other way to get rid of the existing vlues without changing the memory address of Diary ?
void menu( char *fname)
{
int option;
int totEntries = 0;
DiaryType Diary;
.....
case 1: doCreate(&Diary) ; break;
.....
}
int doCreate(DiaryType *Diary )
{
char year[5] ;
char fname[ MAX_FNAME ] ;
char owner[MAX_OWNER + 1];
char yn ;
FILE *fp ;
if(Diary->fname[0]!='\0')
{
printf("A file is already open. Close the file(Y/N): "
rewind(stdin);
yn=getc(stdin);
if(yn=='Y' || yn =='y'){
doExit(Diary) ;
menu(fname) ; <======= I am going back to the menu function to get rid of the old values stored in the Diary structure. Is there any other way to get rid of the existing vlues without changing the memory address of Diary ?