Our instructor asked us why its important to be able to replace values in a pointer........Here is what I came up with...

By using a pointer, a block of memory is allocated at runtime, therefore a program can be more flexible than one that allocates all its memory at once(read from a book). Also, a pointer is easy to store rather than a large struct or a class object.A pointer just stores an address that can be easily passed to a function whereas if an object is passed to a function it had to be constructed, copied and destroyed.......making total sense of a pointer. But its giving examples of this that I'm having a mentall block with. Any help will be appreciated thanks, I think that this will totally clear me up on pointers.Smarkles.

I think your answers foreground is good.

Changing values in pointers are good also because, as you said, it stores a block of memory that can be passed to any variable at any given time.

A pointer is a variable that contains the address of another variable. Pointers and arrays are closely related, are sometimes the only way to express a computation, and usually lead to more compact and efficient code.

Pointer handling means greater if we understand that they contain and pass memory address blocks easily, allowing the change of such a variable simple. They can be passed through functions, and be altered there. The complexity of it all makes it all to simple. Pointers co-exist with their main source. The change of one affects the other(s).

In the simplest terms, pointers resemble mirror-like.

I hope this sounds understandable.

- Stack Overflow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.