bartc <b...@freeuk.com>:

> Bear in mind C allows you to do this:
>
> int *A[10];    // array of pointers to int
> int (*B)[10];  // pointer to array of int
> int i;
>
> *A[i];         // index then deref to get the int
> (*B)[i];       // deref then index to get the int
>
> That's fine so far: one is an array of pointers, other is a pointer to
> an array. However, you can also do this:
>
> (*A)[i];       // deref an array then index
> *B[i];         // index a pointer then deref
>
> which is wrong, and can crash the program. A compiler however will not
> detect it as it is perfectly legal, meanwhile it will deluge you with
> hundreds of pointless warnings.

Never in my decades of C programming did I run into such crashes.

C is a fine programming language. Pascal would have made a better one,
but C is just fine.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to