This comment is hidden because it contains spoiler information about the solution
char *ptr = (char *) malloc(len * sizeof(char));
missing 1 byte for the NUL terminator, and ptr is not nul-terminated after the copy
ptr
yes
try a different language??
For JS it 7 or lower
Basically fizzbuzz in another format
Because the global var isn't reset between your function calls and keeps its value.
tried global counter; it was working on my IDE...
Only because you called your function once only. Call it a second time and you'll see why it doesn't work here.
Agreed!
Loading collection data...
This comment is hidden because it contains spoiler information about the solution
missing 1 byte for the NUL terminator, and
ptr
is not nul-terminated after the copyyes
try a different language??
This comment is hidden because it contains spoiler information about the solution
For JS it 7 or lower
Basically fizzbuzz in another format
Because the global var isn't reset between your function calls and keeps its value.
Only because you called your function once only. Call it a second time and you'll see why it doesn't work here.
Agreed!