What is the difference between if (p == q) and if (*p == *q)?

+1 vote
asked Oct 10 by anonymous

4 Answers

0 votes
answered Oct 11 by (660 points)
p==q; //compare the two memory addresses

*p=*q;//compare the two content from that address(p and q)
+1 vote
answered Oct 11 by (340 points)
edited Oct 15 by
if(p==q) -- it means that it checks the "address "of p and q

if(*p==*q)--it means that it checks the "values" of p and q

so p is never equals to q

     *p is may be equal to *q (depends on given programm)
commented Oct 11 by (340 points)
if you have doubt message me insta id(gutsboy_harsha)
0 votes
answered Oct 12 by anonymous
P  and Q are variables. (p==q) in this condition compare the values of variables.

(*p==*q) in this condition compare address of variables that's are store values.
0 votes
answered Nov 7 by (1,070 points)
for (p==q)we can able to insert only one value but,for (*p==*q) we can able to insert many values
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...