25 lines
540 B
C
25 lines
540 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
void f(const char s[], char *ext) {
|
|
uint i = 0;
|
|
while (s[i] != 0) {
|
|
char c = s[i];
|
|
ext[i] = c + ((c >= 65 && c <= 90) * 32) - ((c >= 97 && c <= 122) * 32);
|
|
i++;
|
|
}
|
|
ext[i] = 0;
|
|
}
|
|
|
|
int main() {
|
|
char s[256];
|
|
char s1[] = "baab";
|
|
char s2[] = "kayak";
|
|
char s3[] = "Hello Word!";
|
|
f(s1, s);
|
|
printf("f(\"%s\") = \"%s\"\n", s1, s);
|
|
f(s2, s);
|
|
printf("f(\"%s\") = \"%s\"\n", s2, s);
|
|
f(s3, s);
|
|
printf("f(\"%s\") = \"%s\"\n", s3, s);
|
|
} |