2009/10/10 Jürgen Hestermann <juergen.hesterm...@gmx.de>: >> I can't understand what you are trying to say. An array is a pointer >> to where the elements of the array resides in memory. How else do you >> think it works? > > just look at: > > type ArrayType = array[1..10] of char; > var X : ArrayType; > PX : ^ArrayType > > What is the difference between X and PX? > > X is an array of char which can be accessed directly. The identifier X means > the address in memory where the array elements 1..10 are stored. The address > of X (@X) is the address of the array (first element). > > XP is just a pointer to such a structure. It's not the array itself. The > address of XP (@XP) is the address of the pointer, not the array. > > Sizeof(X) is 10 bytes. > Sizeof(PX) is 4 bytes. > > Still you can use X[1] and PX[1]. That's illogical.
Right, I see what you mean, now. Contrary to what I thought arrays are not pointers (in syntax, at least), this is indeed confusing. I hardly ever use pointer arithmetic in pascal, though, so it doesn't really bother me. Henry _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal