2
As I do in this code, when he type a letter read by the keyboard with the type scanf (char) it repeats until the Z?
#include <stdio.h>
#include <stdlib.h>
int main()
{
char c;
/*for (c= 'A'; c<='Z'; c++){
printf("Letra = %c\n", c);
} */
system("pause");
return 0;
}
Only works with capital letters. I put it like this and stuck it for(; c<='Z' || 'z'; c++) {
– user24857
How do ||(or) then no for z and Z?
– user24857
@user24857 I think you wanted to do
for(; c<='Z' || c<='z'; c++) {
. Yourfor
"brake" (entered an infinite loop) because the second condition of "or" -'z'
- is always true (because it is different from zero). Alreadyc <= 'z'
may or may not be true. Only if you do the code like this, it will print other characters that are not letters (because between the intervalsa-z
andA-Z
there are several symbols).– mgibsonbr