> Question: why is there a ; after your case 'I':?
While it serves no purpose, the ; at the end does no harm.
You can, in C, in most places, have ; by itself and it will have no effect. a ';' just denotes the end of a statement. This is valid code:
int main ( void ) {;;;;;;;;;;;;;;;;;;;;;;;;;;; return 0;}
A ';' by itself is simply considered a 'null statement', meaining it has no effect. It _DOES_ have an (usually unwanted) effect in places like:
if( a < b );
{
printf("This will _always_ display!");
}
In places like:
for(x=0;x<10;x++);
{
printf("This only displays once!");
}
But in this case:
switch(x)
case 't': ;
{
printf("this block still executes, the ; has no adverse effect");
}
We're ok. Anyway...
Code:
case 'I':
{
/**
*** What is the purpose of these next two?
**/
char Y[]="Y";
char N[]="N";
char choice1 = 'Z';
k = 5 - j;
printf("\nThere are currently %i spaces in the data base", k);
if(j<5)
{
printf("\n\nEnter the Student's first name:\t\t ");
scanf("%s", studalltemp[j].fNametemp);
printf("\ndatabase. Please conform that these details are correct (Y/N)");
choice1 = getchar();
getchar( );
k = 0;
/**
*** You may want: if( upcase(choice1) == 'Y' )
**/
if (choice1 == 'Y')
{
printf("\n1 student record saved to file\n");
strcpy(studall[j].fName, studalltemp[j].fNametemp);
j++;
}
else
/**
*** You may want: if( upcase(choice1) == 'N' )
**/
if (choice1 == 'N')
{
printf("Here");
}
else
{
printf("%c is not a valid option.", choice1 );
}
}
break;
Try that on for size.
Quzah.