I was up coding at 3 AM last night, and I wake up today and find this in a source file: (curse words redacted)
void append_this_stuff(char *stuff_to_append_to[], char **stuff_to_append, int position) {
char the_actual_stuff[] = *(stuff_to_append_to);
char *screw_me = *(stuff_to_append);
int someNumber = strlen(screw_me);
int j = 0;
for (int i = position; i < (someNumber + position - 1); i++) {
the_actual_stuff[i] = (screw_me + j);
j++;
}
stuff_to_append_to = &the_actual_stuff;
}
When I try to compile it, I get this error:
<project root>/src/brstring.c: In function ‘append_this_stuff’:
<project root>/src/brstring.c:38:28: error: invalid initializer
char the_actual_stuff[] = *(stuff_to_append_to);
^
<project root>/src/brstring.c:46:24: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
the_actual_stuff[i] = (screw_me + j);
^
<project root>/src/brstring.c:50:21: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
stuff_to_append_to = &the_actual_stuff;
Does anyone have any idea if I'm doing this right? I'm compiling via the C99 standard and cmake and I'm using GCC on Fedora Linux, should that affect anything.