I have a variable and a method:
char alfabet2[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
char is_mixed(char* str) {
for (int x = 0; str[x] != '\0'; x++)
{
if (str[x] >= 'a' && str[x] <= 'z') {
alfabet2[] = "abcdefghijklmnopqrstuvwxyz"
} else if (str[x] >= 'A' && str[x] <= 'Z') {
alfabet2[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
} else if (str[x] >= '0' && str[x] <= '9') {
alfabet2[] = "0123456789"
}
} return alfabet2;
}
Can someone please help me to make it out?
As shown in the Output, the declaration int x = 0
inside the for
loop is not allowed with ANSI C. You will need to use C11 or C99.
Or you declare the integer outside of the for
loop.
aE:
int x = 0;
for(x; str[x] != '\0';x++){....
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.