Simple: you are comparing two pointers. If there are both pointing at the same place, then they are equal. If they point at different addresses, they are not the same.
p
is pointing at a constant string,
q
is pointing at a memory location (on the stack) which happens to contain the same data, but is not in the same place. (If it was, then any change to the content pointed at by
q
would affect all the constant references to "ram" which would be a very, very bad thing!)
If you want to compare teh string contents, then use
strcmp[
^] instead.