the attached file is a c code give me the following error :
goto hypasses intialization of local variable.
any help in that please
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
----------
#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
clrscr();
int m=0;
char NAME[10] ; int spec=0; char c; int counter1=0,counter2=0;
int NO[10]; int n=0; int CONTINUE;
char mail[40];
int No1 = 0,IND=0; // to count number of entered @
int No2 [40]; //to enter the . indices
int l=0; // used to insert the indices of .
int counts =0; // used to count the number of . after @
char verify;
struct Employee
{
char NAME[3][10];
char NO[3][10];
char mail[3][40];
};
struct Employee E ;
/* INTIALIZE MY ARRAYS*/
start:
for(int f=0;f<10;f++)
E.NAME[m][f]='\0';
for(f=0;f<=39;f++)
E.mail[m][f]='\0';
for(f=0;f<40;f++)
No2[f]=0;
/* process for entering the name */
printf("\tthe user name must not be excessed 10 charachter to avoid
truncation\t\n ");
m1:
printf("\nEnter user name:\t");
for (int i=0; i< 10; i++)
{
c=getche();
spec= c;
// printf("%f",spec);
if (spec == 13)
{
break;
}
else
{
if ((spec >= 65) && (spec<= 90) || spec==32 )
{
E.NAME[m][i]=c;counter1++;
}
else
{
printf("\nYOU MUST ENTER CAPITAL CHARACHTERS ONLY");
goto m1;
}
}
}
if(counter1<5)
{
clrscr();
printf("Name sould be mre than 5 charachters"); goto m1;
}
spec=0;
if(CONTINUE != 0)
goto place;
/* process for entering the data */
m2:
printf("\n Enter the employee phone No\t");
for (int r=0;r<10;r++)
{
c=getche();
spec= c;
if (spec == 13) // Exit if user enter 'Enter button'
{
break;
}
else
{
if ((spec >= 48) && (spec<= 57))
{ E.NO[m][r]=spec-48; counter2++; }
else
{
printf("\n Invalid phone number");
goto m2;
}
}
}
if(counter2<5) // test if the user enter a phone number less than 5 Nos
{
clrscr();
printf("\nYou must enter a phone nuumber that not less than 5 numbers
"); goto m2;
}
spec=0;
if(CONTINUE != 0)
goto verif;
// process to enter and check entered mail
m3:
printf("\n Enter the email:");
counts=0;
No1=IND=0;
for(i=0;i<40;i++)
{
c=getche();
spec= c;
if (spec == 13) // Exit if user click 'Enter button'
{
break;
}
else
{
if(spec==64)// detect @ location and indecis
{
E.mail[m][i]=c; No1++; IND=i;
}
else if(spec==46) // detect dots location
{
E.mail[m][i]=c; No2[l]=i; l++;
}
else if ((spec>=48)&&(spec<=57)) E.mail[m][i]=c;
else if ((spec>=65)&&(spec<=90)) E.mail[m][i]=c;
else if((spec>=97)&&(spec<=122)|| spec ==95 ) E.mail[m][i]=c;
else
{
printf("\n Email not contain special charachters reinput it
");
No1=0;
l=0; counts =0;
goto m3;
}
}
}
// test the format [EMAIL PROTECTED]
if ((No1>1)||No1==0)
{
printf("\n email should contain one @ charachter");
goto m3;
}
else
{
for(int x =0,l; x< 40 ; x++)
{
if((No2[x]>IND)&&(No2[x]-IND !=1))
counts++;
}
if(counts ==0)
{
printf("\n it must have at least one . after @ separated by one
charachter");
goto m3;
}
}
if(CONTINUE != 0)
goto place;
printf("\t YOU NOW ENTERED THE FOLLOWING DATA :");
printf("\nEmployee Name:\t");
for(int d=0;d<10;d++)
printf("%c",E.NAME[m][d]);
printf("\nEmployee phone number:\t");
for(d=0;d<counter2;d++)
printf("%i",E.NO[m][d]);
printf("\nEmployee e-mail:\t");
for( d=0;d<40;d++)
printf("%c",E.mail[m][d]);
place:
printf("\nClick M to modify this date, or N to continue enter the othe
employee data"); char vreify=getche();
switch(vreify)
{
case 'N':
{
CONTINUE =0;
if (m<3)
m++;
goto start;
}
case 'M':
{
s:
printf("\nselect which feild you wanna change? \n\tselect 1 for
modifying name, 2 for modifying phone No,3 for modifying e-mail,or -1 to exit
");
scanf("%i",&CONTINUE);
switch(n)
{
case 1:
goto m1;
case 2:
goto m2;
case 3:
goto m3;
case -1:
break;
default: printf("\nWrong selection"); goto s;
}
}
case 'e':
break;
default:
{
printf("\nInvalid charachter");
goto place;
}
}
getch();return 0;
}
[Non-text portions of this message have been removed]