Code: Select all
int *pint = 1234;
int *litre;
*litre = 1234;
And WHICH IDIOT made a SYSTEM programming language WITHOUT putting the BIT SIZES of the standard types into the standard? A valid 32-bit C compiler for x86 can, while following the standard, have an 8-bit int and a 64-bit long long (as long as a short and char is no more than 8 bits either). Only conventions keeps the programs running, not the standard.
Code: Select all
int *ptr, notptr;
Code: Select all
void myfunc(int *);
When to use the * is confusing for starters because it means the EXACT OPPOSITE in different parts of the program.
Code: Select all
int * here_it_means_i_want_a_pointer;
Code: Select all
*however_if_i_use_it_here = it_means_i_DONT_want_the_pointer_but_the_value_it_points_to;
C has 15 levels of precedence (C++: 17). How many C programmers remembers the relative precence of bitwise and compared to bitwise or? Not many.
To be "consequent", C does not use = for equality testing, it uses ==. This is a huge source of hard-to-detect program errors for programmers. But at least it's consequent, right? Not really. Because when you type a <= b you actually do use = for equality testing, even though = means assignment. If this system was truly consequent then <= would be to < as += is to +, and do an assignment of the boolean value of a less-than comparision.
Yep. += adds and assigns.
-= subtracts and assigns.
*= multiplies and assigns.
/= divides and assigns
%= does modulo and assigns
>>= shifts right and assigns
<<= shifts left and assigns
&= does bitwise and and assigns
^= does bitwise xor and assigns
|= does bitwise or and assigns
<= does NOT do a less-than comparison and assigns.
And they did this to be consequent? (By the way, why is there no &&= operator?)