On this godbolt link at https://godbolt.org/z/GfeTobMvs, the two C source codes behave identical. Yet the second source code does not use vectors and is 30% slower when I tested it.