ok i think it works loading the names but when i go to load in the ages it crashes
Code:
void load_family ( void ) {
int i ;
char choice[BUFSIZ];
printf( "%senter the all the names of your family.\n" , name );
printf( "hit enter after each name ( q to stop ) : \n");
i = 0;
while( fgets( choice, sizeof choice , stdin) != NULL ) {
sscanf ( choice , "%s" , tree[i].name );
if ( choice[0] == 'q' || i == MAX)
load_ages(); // go to the load_ages function
++i;
}
}
hers where it crashes just trying to print name
Code:
void load_ages ( void ) {
int i ;
char choice[BUFSIZ];
printf( "\n%sEnter the ages of the family you entered!.\n" , name );
printf( " ( q to stop ) :\n ");
printf ( "family member : %s \n", tree[i].name ); //i think it crashes here
/*
puts("enter the age now!");
while ( choice[0]!= 'q' ) {
fgets ( choice , sizeof choice , stdin );
tree[i].age = atol( choice );
if ( fgets ( choice , sizeof choice , stdin ) &&
sscanf( choice , "%s" , tree[i].age)== 1 );
*/
// display_menu();
//}
}