944,160 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 2256
  • C RSS
Sep 16th, 2004
0

The improtance of replacing values in pointers

Expand Post »
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.
Similar Threads
Reputation Points: 12
Solved Threads: 0
Newbie Poster
smarkles is offline Offline
13 posts
since Sep 2004
Sep 17th, 2004
0

Re: The improtance of replacing values in pointers

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
Reputation Points: 26
Solved Threads: 4
Junior Poster
Stack Overflow is offline Offline
185 posts
since Sep 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: Using sound card in C?
Next Thread in C Forum Timeline: file pointer increament





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC