1. " *p1=&m; *p2=&n;" This is wrong. If you want to make pointer p1 to point to integer m, then it should be "p1 = &m".
2. Where did u initilize pointer p. it should be hoding some junk value!!!!!
3. I did not understand your concept of using a while loop for sumation. Moreover in this exercise your not getting any benifit of using pointers!!!!! If you really want to play arround with pointers, do something more complicated...a simple link list might be.