ru...@yahoo.com <ru...@yahoo.com> wrote: > As a side comment (because it always bugs me when I read this, even > though I read it in very authoritative sources), ISTM that C passes > everything by value except arrays; they are passed by reference (by > passing a pointer to the array by value.) Admittedly, the close > relationship between arrays and pointers makes it easy conflate them.
Arrays are distinctly second-class citizens in C. Basically, in C, arrays aren't passed at all but there's some syntactic sugar so you can squint and con yourself that they're passed by reference. If you try to pass an array, the array name immediately decays to a pointer, and the pointer gets passed instead -- by value. The corresponding function parameter must be a pointer to an approrpriate kind of thing, though you're allowed to write []s to confuse yourself if you like -- T D[] in a function parameter declaration means precisely the same as T *D -- to the extent that &D has type T **D and so on. -- [mdw] -- http://mail.python.org/mailman/listinfo/python-list