habe da folgenden Code:
1 | #include <stdio.h> |
2 | #include <stdlib.h> |
3 | #include <string.h> |
4 | |
5 | #define STRING_LENGTH 100
|
6 | |
7 | int main() |
8 | {
|
9 | char vorname[45] = {"ABC"}; |
10 | char vorname2[10] = {"ABC"}; |
11 | |
12 | if(strcmp(vorname, vorname2)) |
13 | printf("Strings nicht gleich!!"); |
14 | else
|
15 | printf("Strings gleich!"); |
16 | |
17 | strcpy(&vorname[4], vorname2); |
18 | printf("Ausgabe: %s", vorname); |
19 | |
20 | return 0; |
21 | }
|
Wieso kopiert strcpy den string vorname2 nicht an Vierter Stelle von vorname???? Das müsste doch so hinhauen!