Purchase Solution

Reference parameter variable

Not what you're looking for?

Ask Custom Question

Design a module named getNumber which uses a reference parameter variable to accept an Integer argument. The module should prompt the user to enter a number and then store the input in the reference parameter variable.

I'm having difficulty comprehending the concept of a reference variable. I've written my module below, however I'm unsure if I'm correct. I respectfully request your review and suggestions.

Module main ()
//Declare and initialize variable
Declare Integer = 99
//Display the value in variable
Display "x is set to", x

//Pass variable to getNumber
Call getNumber (x)

//Display the values now
Display "Enter a number"
Input number
Display "x is set to", x
End Module

Module getNumber (Integer Ref value)
Set value = 0
End Module

Purchase this Solution

Solution Summary

Solution also gives a corresponding C++ implementation to see the reference variable in action.

Solution Preview

Following is how your module code should look like to address the given problem.

Module main ()

// Declare and initialize variable
Declare Integer x = 99

// Display the value in variable
...

Purchase this Solution


Free BrainMass Quizzes
Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

C# variables and classes

This quiz contains questions about C# classes and variables.

Basic Networking Questions

This quiz consists of some basic networking questions.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.