Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to re-initialize a Struct variable ?

Status
Not open for further replies.

zavrisky

Programmer
Oct 6, 2001
7
AU
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 ?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top