The C# version uses unsafe raw pointers which is practically the same as writing it in C. No surprise then that the outcomes are similar.