0

Someone please explain assignment operators.

I'm not able to understand the assignment operator(=)

20th Sep 2017, 1:43 PM
Abhishek Anand
Abhishek Anand - avatar
2 Answers
+ 6
(variable) = (value to assign to variable) It is how you store information into your variables / memory. x = 1; // this assigns the value of 1 to the variable x Think of it like a mailbox and mail. It is an isolated slot of memory that's used to store some particular information inside of it. It has your name listed (variable) and your apartment number (memory location). When the mailman arrives, he assigns the mail that belongs to you into your mailbox (variable). Then when you need your mail later, you can retrieve it from that location so you can use it.
20th Sep 2017, 1:57 PM
AgentSmith