This program is running in GNU compiler(g++ & gcc). Only it depends On Array Implementation in compiler. As geven answer by me is tested on Solaris machine using gcc compiler.