Answer to Question #50608 in C++ for Umer
(or possibly more impenetrable) by simulating their operation with a class.
To clarify the operation of our homemade pointers, we’ll model the computer’s memory
using arrays. This way, since array access is well understood, you can see what’s really
going on when we access memory with pointers.
We’d like to use a single array of type
char to store all types of variables. This is what a
computer memory really is: an array of bytes (which are the same size as type char),
each of which has an address (or, in array-talk, an index). However, C++ won’t ordinarily
let us store a float
or an int in an array of type char. (We could use unions, but
that’s another story.) So we’ll simulate memory by using a separate array for each data
type we want to store. In this exercise we’ll confine ourselves to one numerical type,
float,so we’ll need an array of this type; call it fmemory. However, pointer values
(addresses) are also st
Need a fast expert's response?Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!