Homework - Differences in Access to Values

So I had to write a program in Pascal (bubble sort, it was pretty easy) and at the end my professor asked a question about our code. He made us write two separate printing procedures. The first printArray took an Array of Integer as a parameter, where printArray2 took a type called arrayType, which is defined as such:

TYPE
arrayType = ARRAY[1..20] OF INTEGER;

      

Now I'm a little upset, but his question is, "What's the difference in how the values ​​are available when using different printing procedures?"

Just wondering if anyone can give me a hint. My original thought was that it has to do with how memory locations are accessed, but I don't know how to put it right.

Well, I hope one of you wonderful people can help me.

+3


source to share


2 answers


I assume your teacher introduced you to the concepts of pass by value and pass by reference. I believe you are a teacher trying to get you to think about these concepts as it relates to primitive array declaration and your own array declaration. This should at least give you a hint of your homework.



0


source


It depends a little on the dialect + Pascal compiler, but I assume its a difference between a typed array and an open array, the latter of which has a different range (0..number_of_elements-1) than the previous one (1..number_of_elements)



0


source







All Articles