I AM NOT ABLE TO LOCATE MY ERROR.
I HAVE COMMENTED MY CODE TO HELP UNDERSTAND MY LOGIC.
I HAVE OBSERVED THAT ON INCREASING THE SIZE OF MY ARRAY THE TIME AFTER WHICH RUNTIME ERROR IS COMING IS ALSO INCREASING SO I GUESS MY PROGRAM S GOING IN AN INFINITE LOOP HENCE GOING OUT OF BOUND BUT IT IS WORKING FINE IN CODE::BLOCKS