+ 6

Can we compare two structures using "==" operator

If yes then why and if no then why not

14th Feb 2019, 5:42 AM
Kailash Loncha
Kailash Loncha - avatar
16 Answers
+ 7
Hi Terminator you're back! (I'm so thrilled!) Well, to answer your question, each struct created is an arrow that references to a particular object. Therefore, you're seeing if the first arrow references the exact same struct that the 2nd struct is referencing.
14th Feb 2019, 6:30 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 8
Haha Serena Yvonne! I probably changed my name like 3 times.
14th Feb 2019, 9:37 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 6
Let's bring this discussion into private chat discussion :)
14th Feb 2019, 6:50 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 6
I wouldn't mind if you asked :) Btw the times have changed so I doubt we should be speaking here.
14th Feb 2019, 9:51 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
Cannot compare structures like that but you can compare pointers to structures to see if they refer to the same structure.
15th Feb 2019, 9:18 AM
Sonic
Sonic - avatar
+ 4
⚡Prometheus ⚡ good to see you again brother
14th Feb 2019, 6:48 AM
Kailash Loncha
Kailash Loncha - avatar
+ 3
⚡Prometheus ⚡ what is your old username
14th Feb 2019, 6:45 AM
Kailash Loncha
Kailash Loncha - avatar
+ 3
$Vengat Terminator Have I answered your question btw?
14th Feb 2019, 6:47 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
15th Feb 2019, 3:30 AM
Kailash Loncha
Kailash Loncha - avatar
+ 2
Well yes we can because the "==" operator either makes the first variable/structure equals to the next variable/structure what I mean is if u put it in an if statement it checks if the two structures/variables are the same then it runs the if statement
14th Feb 2019, 6:04 AM
Sonicspeed^__^
Sonicspeed^__^ - avatar
+ 1
Yeah. It is relational operator. Relational operators are only used to compare two or more things. I think you got the answer.
29th Sep 2019, 11:43 AM
Sankar Rao Mudadla
Sankar Rao Mudadla - avatar
0
Actually yes, but the == operator will only check if the two references of structs point to the same struct.
24th Oct 2019, 8:05 PM
Davide Sericoli
- 1
May be "equals"?
16th Feb 2019, 4:14 AM
Vladimir
Vladimir - avatar