28 lines
524 B
C
28 lines
524 B
C
#include <stdio.h>
|
|
#include <string.h>
|
|
int main() {
|
|
char foo[4] = "foo";
|
|
char bar[4] = "bar";
|
|
|
|
printf("foo ist %d Zeichen lang\n", (int)strlen(foo));
|
|
|
|
printf("foo: %s \n", foo);
|
|
printf("bar: %s \n", bar);
|
|
|
|
char foobar[7];
|
|
strcpy(foobar, foo);
|
|
printf("foobar: %s \n", foobar);
|
|
|
|
strcat(foobar, bar);
|
|
printf("foo ++ bar -> foobar: %s \n", foobar);
|
|
|
|
if (strcmp(foo, bar) == 0) {
|
|
printf("foo = bar \n");
|
|
}
|
|
else {
|
|
printf("foo != bar \n");
|
|
}
|
|
|
|
return 0;
|
|
}
|