You have a problem with a buffer overflow:
char temp[] = { "" };
char tempc[2];
temp[0] = url[i];
temp[1] = '\0';
strcat(temp, tempc);
Interestingly, both gcc and clang will compile the code happily and not report this error. This is
probably the source of the write error you're getting (MSVC ?)
However, gcc with -O1 does flag another bug:
warning: storing the address of local variable ‘temp’ in ‘*_35 + _38.value’ [-Wdangling-pointer=]
(*out)[count - 1].value = temp;
~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
This means that the variable
temp
is on the stack, so it "disappears" after the function returns (not really, but for the sake of this discussion assume it does). So two issues here. If you try to access the
value
member of the
out
parameter after the function returns, it's unknown what happens. You may get a sensible value, you may get a garbage value, you may get a program crash. The other problem is that all of the elements of the
out
array get pointers to the same
temp
variable. That means as you modify the value of temp,
every member of the array ends up with the same value of the
value
member. That's probably not what you want.