Ok, let's disect what this does.
p is a pointer to name\0. So, here you are comparing p (a pointer) to "name" (also a pointer). Well, the only way this will every be true is if somewhere you have p="name" and even then, "name" is not guaranteed to point to the same place everywhere.
I believe what you are actually looking for is either strcmp to compare the entire string or your wanting to do if (*p == 'n') to compare the first character of the p string to the n character
You want to use strcmp() == 0 to compare strings instead of a simple ==, which will just compare if the pointers are the same.
The expression strcmp( p, "name") == 0 will check if the contents of the two strings are the same.