ordering wuth the help of pointer