Array length: Difference between revisions

m
m (output format unification)
Line 575:
it is important that the sizeof operator, which returns a number of bytes,
behaves quite differently for arrays and for memory pointers.
</p><p>
 
The problem is that arrays are passed to functions (procedures) via pointers.
Even if we define a global variable as an array, after using it as a function
argument the appropriate parameter will "forget" what size the array is.
</p><p>
Therefore, an object-oriented technique is used in the solution below. (This is possible even without the advantages C.) Block of memory in which is stored the array is wrapped in structure and thus the size of the array can be easily stored. It is very convenient. Having defined such "classes" as StringArray, their use is easy and hassle-free. Nevertheless, the C language is not designed for OOP, and therefore C ++ is simply better for these kinds of applications.
</p>
====Solution====