The Student Room Group

Parameters Computer Science

I have this question which I’m stuck in and don’t know the answer to my guess is that rear and front are part of the parameter but I’m not sure I’ll post the question below appreciate any help
Reply 1
image.jpg
The 'parameter' in the example you've posted is 'item'. Parameters are the arguments or 'values' that are passed into functions/methods (in your example its called a procedure). You've made an easy mistake by looking and thinking that 'front' and 'rear' are the parameter(s), from what I can tell these are variables, that in this case are being used as 'indexers' , which are used to access the value at a certain position in a linear data structure (such as queue from your example).
(edited 4 years ago)
Reply 3
Original post by Strange5050
The 'parameter' in the example you've posted is 'item'. Parameters are the arguments or 'values' that are passed into functions/methods (in your example its called a procedure). You've made an easy mistake by looking and thinking that 'front' and 'rear' are the parameter(s), from what I can tell these are variables, that in this case are being used as 'indexers' , which are used to access the value at a certain position in a linear data structure (such as queue from your example).

So the procedure is the parameter?
Original post by A0W0N
So the procedure is the parameter?

No, all a procedure is, is a way to execute some code, the keyword 'procedure' is used to define some code that is 'seperate' from the main body of code. A parameter is a value that the code within a 'procedure' can use. Let's imagine we had the following:

procedure less_than_ten (number) // 'number' is the parameter.

if number < 10
// Do something
else number > 10
// Do something
endif

endprocedure

In the simplified example above, the procedure is the code that is executed when 'less_than_ten()' is called, in this case the code that ran is the 'if-statement' which as you can see has two different outcomes. The parameter is number in this case, this is because 'number' is the value that the procedure takes as an 'arguement'. The procedure here will always execute the same code, but the result of calling this procedure may be different because the parameter (number) can be different (it might be less than 10, or greater than 10).

To simplify is down to its bare bones - Parameters are what are between the brackets after the procedure name that can be used or referred to in the code that the procedure contains.

I don't know whether I've made this clear, try this link, as it should be helpful: https://www.bbc.co.uk/bitesize/guides/z9hykqt/revision/4 Apologies if I have confused you further.
(edited 4 years ago)

Quick Reply

Latest

Trending

Trending