Question

C++ 1a) Assume that you have an integer variable named myint. Call xyzfunc and pass myint...

C++

1a) Assume that you have an integer variable named myint. Call xyzfunc and pass myint as a parameter.

a) xyzfunc(myint)

b) myint(xyzfunc)

c) xyzfunc(&myint)

c) call xyzfunc(myint)

1b) Code the function definition for xyzfunc, picking up a local copy of myint. xyzfunc has no return value.

a) void xyzfunc (int &myint);

b) void xyzfunc (myint);

c) void xyzfunc (local myint);

d) void xyzfunc (int myint);

1c) If xyzfunc executes myint++, what happens to the copy of myint in the calling program?

a) It is incrementd by one.

b) Its address is incremented by four.

c) It doesn't change.

d) It doesn't change until the function returns.

1d) Change the function definition for myint so that xyzfunc uses the same memory locations for myint as in the calling program.

a) void xyzfunc (&int myint);

b) void xyzfunc (int &myint);

c) void xyzfunc (int * &myint);

d) void xyzfunc (&int &myint);

1e) This time, if xyzfunc executes myint++, what happens to the copy of myint in the calling program?

a) Its address is incremented by four.

b) It is incremented by one.

c) It doesn't change.

d) It doesn't change until the function returns.


Homework Answers

Answer #1

1)

Assume that you have an integer variable named myint. Call

xyzfunc and pass myint as a parameter.

a) xyzfunc(myint) it call function xyzfunc() and pass the value of the variable myint as parameter

1b)

Code the function definition for xyzfunc, picking up a local copy of myint. xyzfunc has no return value.

d)void xyzfunc (int myint); it declare myint lical variable for xyzfunc()function

1c) If xyzfunc executes myint++, what happens to the copy of myint in the calling program?

c) It doesn't change

1d) Change the function definition for myint so that xyzfunc uses the same memory locations for myint as in the calling program.

b) void xyzfunc (int &myint);

1e) This time, if xyzfunc executes myint++, what happens to the copy of myint in the calling program?

a) Its address is incremented by four.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
C++ 5a)We have the following class: class Banana { private:      string s;      int y;...
C++ 5a)We have the following class: class Banana { private:      string s;      int y; public: bool theMemberFunc (string); void setterForS(string); // setter for s string getterForS(); // getter for s }; Instantiate a static object of Banana named co. a)int Banana; b)co.Banana = new; c)Banana = new class; d)Banana co; 5b)Code a call to function aNonclassFunction passing co. a)aNonclassFunction (co); b)aNonclassFunction (* co); c)aNonclassFunction (aGoodClass.co); d)aNonclassFunction (aGoodClass); 5c)Code the function definition for aNonclassFunction, picking up co. aNonclassFunction has...
In C language make a structure called funds funds should have variable fields of type int...
In C language make a structure called funds funds should have variable fields of type int id; char bank[10]; float balance; The program would have a function called sum which returns a float. To sum pass structure funds and a pointer called record. initialize record to equal {1, "BOA", 10023.43} call sum passing the pointer record , the function returns a float value into variable result. initialize record to equal {2, "Chase", 4239.87} call sum passing the pointer record ,...
write a c++ program A class called car (as shown in the class diagram) contains: o...
write a c++ program A class called car (as shown in the class diagram) contains: o Four private variables: carId (int), carType (String), carSpeed (int) and numOfCars (int). numOfCars is a static counter that should be  Incremented whenever a new Car object is created.  Decremented whenever a Car object is destructed. o Two constructors (parametrized and copy constructor) and one destructor. o Getters and setters for the Car type, ID, and speed. And static getter function for numOfCars....
Complete this in C++ and explain what is being done. 1      Introduction The functions in the...
Complete this in C++ and explain what is being done. 1      Introduction The functions in the following subsections can all go in one big file called pointerpractice.cpp. 1.1     Basics Write a function, int square 1(int∗ p), that takes a pointer to an int and returns the square of the int that it points to. Write a function, void square 2(int∗ p), that takes a pointer to an int and replaces that int (the one pointed to by p) with its...
Write a C++ program that converts time of day from a 24-hour notation to a 12-hour...
Write a C++ program that converts time of day from a 24-hour notation to a 12-hour notation. For example, it should convert 14:25 to 2:25 PM. (A) The user provides input as two integers separated by ‘:’. The following function prototype should capture the user inputs as described below: void input(int& hours24, int& minutes); //Precondition: input(hours, minutes) is called with //arguments capable of being assigned values. //Postcondition: // user is prompted for time in 24 hour format: // HH:MM, where...
Description: In this assignment, you need to implement a recursive descent parser in C++ for the...
Description: In this assignment, you need to implement a recursive descent parser in C++ for the following CFG: 1. exps --> exp | exp NEWLINE exps 2. exp --> term {addop term} 3. addop --> + | - 4. term --> factor {mulop factor} 5. mulop --> * | / 6. factor --> ( exp ) | INT The 1st production defines exps as an individual expression, or a sequence expressions separated by NEWLINE token. The 2nd production describes an...
Create a C++ project. Download and add the attached .h and .cpp to the project. Write...
Create a C++ project. Download and add the attached .h and .cpp to the project. Write an implementation file to implement the namespace declared in the attached CSCI361Proj5.h. Name the implementation file as YourNameProj5.cpp and add it to the project. Run the project to see your grade. .h file: // Provided by: ____________(your name here)__________ // Email Address: ____________(your email address here)________ // FILE: link.h // PROVIDES: A toolkit of 14 functions for manipulating linked lists. Each // node of...
Question Recursive Maximum: In this question you must develop and use a recurive function to find...
Question Recursive Maximum: In this question you must develop and use a recurive function to find the maximum value in array of integers. Complete the C program, Maximum.c, by implementing the recursive function maximumValue, and the regular function max, and completing the main function using the comments provided. Open the file Maximum.c, complete, compile and run it. When you are sure it is correct, include the c file in your final submission. Note that the function max is not recursive....
we defined, implemented, and tested a class Time. In this lab, we will continue working with...
we defined, implemented, and tested a class Time. In this lab, we will continue working with the Time class. A. Separate the class definition and class implementation from the client program. Move the class definition into a header file named Time.h and move the class implementation into a cpp file named Time.cpp. Use preprocessor directive to include header files as needed. B. Modify the Time class as follows: 1. Replace the default constructor and overloaded constructor with a constructor with...
Data Structures using C++ Consider the classes QueueADT and ArrayQueueType: QueueADT: #ifndef QUEUEADT_H #define QUEUEADT_H template...
Data Structures using C++ Consider the classes QueueADT and ArrayQueueType: QueueADT: #ifndef QUEUEADT_H #define QUEUEADT_H template <class ItemType> class QueueADT { public:        // Action responsibilities        virtual void resetQueue() = 0;           // Reset the queue to an empty queue.           // Post: Queue is empty.        virtual void add(const ItemType& newItem) = 0;           // Function to add newItem to the queue.           // Pre: The queue exists and is not full.          ...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT