I'm trying to set some string variables like this:
char thingA[7], thingB[7], thingC[7];
strcpy(thingA, "StringA");
strcpy(thingB, "StringB");
strcpy(thingC, "StringC");
printf("%s\n", thingA);
printf("%s\n", thingB);
printf("%s\n", thingC);
but instead of outputting like this:
StringA
StringB
StringC
it outputs like this:
StringA StringB StringC
StringB StringC
StringC
I've tried this with sprintf
, but get the same result.
I honestly have no idea what's going on, or how to fix this, and I can't find anything on it online, since searching for this kind of stuff has proven hard for some reason.
So basically why is it storing string b and c in a, and c in b?