Test case failing

I tried to dry run my code but my 2 test cases are failing

code- https://ide.codingblocks.com/s/232802

@anubhavb11
check condition in line 13, it should be j>=0

It is giving segmentation fault on that

@anubhavb11
You code seem like a bubble sort and its working work. Try implement inserting sort.

cant we do insertion sort with for loop have a look on my for loop it is not for bubble sort i am trying insertion sort over there.
please tell me where is my code going wrong