[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] gets strengen



> 
> 6.9:	Someone explained to me that arrays were really just constant
> 	pointers.
> 
> A:	This is a bit of an oversimplification.  An array name is
> 	"constant" in that it cannot be assigned to, but an array is
> 	*not* a pointer, as the discussion and pictures in question 6.2
> 	should make clear.  See also questions 6.3 and 6.8.

Her er fx. endnu én som er af en anden mening:
http://www-ee.eng.hawaii.edu/~tep/EE150/book/chap7/subsection2.1.3.2.html

"As we have seen, when we declare an array, a contiguous block of memory is allocated for the
cells of the array and a pointer cell (of the appropriate type) is also allocated and initialized
to point to the first cell of the array. This pointer cell is given the name of the array. When
memory is allocated for the array cells, the starting address is fixed, i.e. it cannot be changed
during program execution. Therefore, the value of the pointer cell should not be changed. To
ensure that this pointer is not changed, in C, array names may not be used as variables on the
left of an assignment statement, i.e. they may not be used as an Lvalue "

Så teknisk set ér det en pointer, compileren holder bare øje med at adressen ikke ændres. Jeg er
lige ved at tro at compileren kan gøre dette i compileringsprocessen, så den slet ikke behøver at
addere ekstra "beskyttende" kode.

Men det var så også mit sidste "offensive" brev i den forbindelse.

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:09 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *