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

+1 vote
asked Oct 10, 2019 by anonymous

4 Answers

0 votes
answered Oct 11, 2019 by rohan ag (1,150 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, 2019 by Harsha (360 points)
edited Oct 15, 2019 by Harsha
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, 2019 by Harsha (360 points)
if you have doubt message me insta id(gutsboy_harsha)
0 votes
answered Oct 12, 2019 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, 2019 by dheeraj (1,090 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.
...