For example, in Code::Block "2 and 3 = 1" while "2 & 3 = 2" I don't know what's the different between 'and' and '&'. Please explain for me. Thank you.
| № | Пользователь | Рейтинг |
|---|---|---|
| 1 | Kevin114514 | 3722 |
| 2 | Benq | 3676 |
| 3 | jiangly | 3640 |
| 4 | turmax | 3450 |
| 5 | tourist | 3408 |
| 6 | strapple | 3360 |
| 7 | Um_nik | 3354 |
| 8 | squareOf105 | 3348 |
| 9 | maroonrk | 3196 |
| 10 | idontwannadothis…e | 3191 |
| Страны | Города | Организации | Всё → |
| № | Пользователь | Вклад |
|---|---|---|
| 1 | Qingyu | 153 |
| 2 | maroonrk | 152 |
| 3 | nik_exists | 151 |
| 4 | maspy | 149 |
| 5 | AmShZ | 147 |
| 6 | Um_nik | 144 |
| 7 | Errichto | 139 |
| 8 | adamant | 135 |
| 9 | BledDest | 134 |
| 10 | cry | 130 |
For example, in Code::Block "2 and 3 = 1" while "2 & 3 = 2" I don't know what's the different between 'and' and '&'. Please explain for me. Thank you.
| Название |
|---|



'and' is logical operator. If both operands are non-zero then 'and' will return 1 else 0. It is equivalent to && operator.
& is bitwise operator. Example
and keyword is an alternative of logical-and (&&) and not bitwise-and (&)
and — logic operator ( 2 and 3) = (true and true) = true = 1
& — bit operator (2 & 3) = binary(10 & 11) = binary(10) = 2