In practice, this "idiomatic":
(!(nome[i] >= 'a' && nome[i] <= 'z'))
Not usually used for standardization issues.
This happens because not all languages in the world use latin alphabet in his writing.
The standard library interface ctypes.h
provides several Rotinas de Classificação de Caracteres
.
Are they:
int isalnum(int);
: Tests whether the character is alphabetic or numidic
(alphanumeric).
int isalpha(int);
: Tests if the character is alphabetical.
int isascii(int);
: Tests if the character is one of 128 characters of
ascii table.
int isblank(int);
: Tests if the character represents a space in
white (space or tab).
int iscntrl(int);
: Tests if the character is a command of control
ASCII.
int isdigit(int);
: Tests if the character is a decimal digit (0-9).
int isgraph(int);
: Tests if the character is printable. (with exception
of space).
int islower(int);
: Tests if the character is alphabetical tiny
(a-z).
int isprint(int);
: Tests if the character is printable. (including
space).
int ispunct(int);
: Tests if the character is different from a space
or any other alphanumeric character.
int isspace(int);
: Tests if the character represents a space in
white.
int isupper(int);
: Test if the character is alphabetical capital
(A-Z).
int isxdigit(int);
: Tests if the character is a hexadecimal digit
(0-9,A-F,a-f).
In your case, the Boolean expression:
(!(nome[i] >= 'a' && nome[i] <= 'z'))
It would be replaced simply by:
(!isalpha(nome[i]))
It’s a way, but there may be better options, just with that stretch of it, anything can do. It can also be wrong because the definition is confused.
– Maniero