Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HOMEWORK 7 Pointers 1. A pointer variable stores a(n) ___________. (5 points) 2. The _____ operator is used to determine a variables address. (5 points)

HOMEWORK 7 Pointers 1. A pointer variable stores a(n) ___________. (5 points) 2. The _____ operator is used to determine a variables address. (5 points) 3. What is the NULL pointer? What technically is its address? (10 points) 4. Write the code to simply declare a float variable y and a pointer fPtr to y. Set the value of y equal to any value you wish via the pointer. (20 points) 5. Assume ptr is a pointer to int and holds the address 12000. On a system with four-byte integers, what address will be in ptr after the statement ptr += 10; ? (5 points) 6. Define a pointer charPtr to point to the string Charmeleon. What will the statement cout << charPtr+3; produce? Write the code to store the letter l in a char variable ch. (5 points)

7. Do the following (6 points each): a. Define a structure Joe that contains an integer member intVar and pointer fPtr to type float. b. Next, define an instance of the structure named Bob. c. Write the code that sets the pointer of Bob to point to the variable y from Problem 4, then use this pointer to set the value of y equal to 11.17. d. Define a pointer sPtr to this structure and initialize it to point to Bob. e. Use the pointer to set intVar equal to 177 and to reset y to 863.33. 8. Use the new operator to dynamically allocate an integer array of size n (to be entered by the user via a cin prompt).

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

Convert Arduino Code in a PIC Microcontroller Using the MPLAB IDE

Answered: 1 week ago

Question

What is project success?

Answered: 1 week ago