Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created October 22, 2019 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/a9acdebcb891a0e3640193c6224cfb59 to your computer and use it in GitHub Desktop.
Save parzibyte/a9acdebcb891a0e3640193c6224cfb59 to your computer and use it in GitHub Desktop.
int tieneUnicamenteLetrasDelAlfabeto(char cadena[]) {
int i = 0;
while (cadena[i]) {
// Si no es del alfabeto y no es un espacio regresamos false o 0
if (
!isalpha(cadena[i])
&& cadena[i] != ' '// El espacio cuenta como válido, si no, simplemente quita la condición
)
return 0;
i++;
}
// Si terminamos de recorrer la cadena y no encontramos errores, regresamos 1 o true
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment