I am currently writing a simple function to calculate the sum of two vectors. Being new to C, I decided that I created some βpsuedo-randomβ values ββfor my vectors and also randomized their length, which is more than necessary for this exercise.
Basically, I just started writing my code and wanted to see what the values ββof my array are.
Here is the code:
#include <stdio.h>
Please note that this code is not next to the finished one - feel free to criticize as much as you like. I know that this is far from polished. However, I noticed something strange. My result often follows this pattern:
w, x, y...z, 0, 0, 0, 0, 0, 0, 0, 0.
Most often, the last values ββin my array will be 0. Not always, but more often than not. In addition, this pattern is usually found in multiples. For example, the last two values ββare 0, 0, then I run the program again, the last four digits: 0, 0, 0, 0, etc.
So why is this happening? I have suspicions, but I would like to hear other thoughts.