Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

. Problem 1: For each of the following, write a single statement that performs the indicated task. Assume that long integer variables value1 and value2

. Problem 1: For each of the following, write a single statement that performs the indicated task. Assume that long integer variables value1 and value2 have been defined and that value1 has been initialized to 200000. (a) Define the variable lPtr to be a pointer to an object of type long. (b) Assign the address of variable value1 to pointer variable lPtr. (c) Print the value of the object pointed to by lPtr. (d) Assign the value of the object pointed to by lPtr to variable value2. (e) Print the value of value2. (f) Print the address of value1. (g) Print the address stored in lPtr. Is the value printed the same as the address of value1? 2. Problem 2: write a code that will simply read an int variable (a) from the user. Write two functions that will do the following: (a) Function printValue: this function receives a constant point to constant value. The function simply prints out the value of a. (b) Function ChangeValue: this function receives a constant pointer to non-constant value. The function will ask the user to enter a new value for a and change the old value. Below is a sample output. - Enter a value for a: 10 // This is in the main function. The old value for a is : 10 // This print statement is in the printValue function. Enter a new value for a: 20 // // This is in the ChangeValue function. The new value for a is : 20 // // This print statement is in the ChangeValue function.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Administration The Essential Reference

Authors: Brian Laskey, David Kreines

1st Edition

1565925165, 978-1565925168

More Books

Students also viewed these Databases questions

Question

Write a report on a universal motor. ( no more than 3 pages )

Answered: 1 week ago