I made a program that simulates a login and when I convert the password that is in int to a string using sprintf it's from the failed segmentation, I tried to use the itoa but it's the error definition
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char login[6]={0};
int passwd;
char senha[6]={0};
char logins[6]="Teste";
char senhas[6]="12345";
do{
printf("\n\tDigite o Login: ");
scanf("%s",login);
if((strcmp(login, logins) == 0))break;
else
printf("\tUsuario: %s Inválido..!!\n", login);
}while((strcmp(login, logins) != 0));
do{
printf("\n\tDigite sua senha: ");
scanf("%d",passwd);
sprintf(senha,"%s",passwd);
if((strcmp(senha, senhas) == 0))
printf("\n\tUsuario e Senha Válidos\n\tAcesso autorizado..!!!\n\n");
else
printf("\tSenha: %s Inválida..!!\n", senha);
}while((strcmp(senha, senhas) != 0));
return 0;
}