************ error************
if(p[ctr].name == pname);

the above line is has an error because strings need to be compared using if(strcmp(str1,str2) == 0);
sorry about that.