Yes the above code is not working and following are the compile time errors. j is used without being initialized. Also the sorting does not work if we have the j set as zero.