Array of constraints challenge

In reply to gani:
It would help others understand what you are trying to do if you showed the declarations of a variables used and explained what you mean by garbage values. Please show examples of what you are seeing versus what you expect.

Are you using signed or unsigned data types?