I have to make a program that college that remove a student from a vector, that when I run the code below, it deletes the student plus leaves a special character in the code, can you help me?
//Remover o Aluno
void removerAluno(DADOSPES p[], int n)
{
char codigo[10];
int i;
printf("Digite o Codigo que deseja excluir: ");
fflush(stdin);
gets(codigo);
int encontrou =0;
for(i=0; i<n; i++)
{
if((strcmp(codigo,p[i].codigo))== 0)
{
encontrou =1;
}
}
for(i=0; i<n; i++)
{
if(encontrou == 1)
{
system("cls");
p[i] = p[i+1];
p[i].DiaN = p[i+1].DiaN;
p[n-1].DiaN = 0;
p[i].MesN = p[i+1].MesN;
p[n-1].MesN = 0;
p[i].AnoN = p[i+1].AnoN;
p[n-1].AnoN = 0;
p[i].idade = p[i+1].idade;
p[n-1].idade = 0;
}
}
printf("Codigo Excluido: %s \n",&codigo );
system("pause");
getch();
}