**diff options**

-rw-r--r-- | pages/docs/c/start.txt | 2 |

1 files changed, 1 insertions, 1 deletions

diff --git a/pages/docs/c/start.txt b/pages/docs/c/start.txt index d7ccc6ecc..77ca1846c 100644 --- a/pages/docs/c/start.txt +++ b/pages/docs/c/start.txt | |||

@@ -290,7 +290,7 @@ You can now replace all ''struct sandwich'' instances with ''Sandwich''. Take no | |||

290 | 290 | ||

291 | ==== Arithmetic ==== | 291 | ==== Arithmetic ==== |

292 | 292 | ||

293 | C supports all the usual mathematics you might want as well as boolean logic (binary logic operations). you can add (''+''), subtract (''-''), multiply (''*''), divide (''/''), modulo (''%''), and then to bit-wise bit logic with XOR (''^''), AND (''&''), OR (''|''), NOT (''!''). It is highly advised to group operations in braces like () to be clear on the order of operation you wanted. So ''%%x = a * b - c / d%%'' is unclear as to what you intended. It is wise to explicitly group like ''%%x = a * ((b - c) / d)%%''. The same goes for the bit-wise operations as well. | 293 | C supports all the usual mathematics you might want, as well as binary logic operations and boolean logic. You can add (''+''), subtract (''-''), multiply (''*''), divide (''/''), modulo (''%''), do bit-wise logic operations with XOR (''^''), AND (''&''), OR (''|''), NOT (''~''), or do boolean logic with operators such as AND (''&&''), OR (''||''), NOT (''!''). It is highly advised to group operations in braces like () to be clear on the order of operation you wanted. So ''%%x = a * b - c / d%%'' is unclear as to what you intended. It is wise to explicitly group like ''%%x = a * ((b - c) / d)%%''. The same goes for the bit-wise operations as well. |

294 | 294 | ||

295 | Note that this arithmetic starts falling apart if you try to add two structs (it doesn't work), as these are not normal integers or floating point values. You can add two pointers of the same type, but do not use ''void *'' for pointer arithmetic as it is unclear what the unit is. Normally a pointer has a unit size of its type size. Also bit-wise arithmetic isn't very useful on floating point values etc. | 295 | Note that this arithmetic starts falling apart if you try to add two structs (it doesn't work), as these are not normal integers or floating point values. You can add two pointers of the same type, but do not use ''void *'' for pointer arithmetic as it is unclear what the unit is. Normally a pointer has a unit size of its type size. Also bit-wise arithmetic isn't very useful on floating point values etc. |

296 | 296 | ||