Contiguous Arrays

David Geary dmg at ssc-vax.UUCP
Tue Feb 21 03:54:45 AEST 1989


  Are ALL arrays in C contiguious?  If I declare an array:

  int  x[10];

  am I GUARANTEED that x[0] through x[9] will occupy contiguous memory,
  or is the compiler free to scatter the elements around in memory?

  I have a difficult time imagining implementing C without contiguous
  arrays, but is the compiler free to implement non-contiguous arrays
  if so desired?

  I have a hard time understanding how one could implement non-contiguous
  arrays, especially when you have functions such as strcpy().  

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ David Geary, Boeing Aerospace,               ~ 
~ #define    Seattle     RAIN                  ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



More information about the Comp.lang.c mailing list