From b2ef6743307960edf682414cdc249c0868fea712 Mon Sep 17 00:00:00 2001 From: Luc Date: Sat, 5 May 2018 16:16:13 -0700 Subject: Wiki page start changed with summary [The bitwise "not" is a tilde, not an exclamation mark. Mentioned logical operators separately to hopefully make it more accurate and clear.] by Luc --- pages/docs/c/start.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pages') 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 ==== Arithmetic ==== -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. +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. 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. -- cgit v1.2.1