Pointer/Dynamic Memory/function problem

This is a discussion on Pointer/Dynamic Memory/function problem within the C++ Programming forums, part of the General Programming Boards category; >What is your favorite book as far as explaining all of this pointer/reference arithmetic? The C++ standard. But, since it ...

  1. #16
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >What is your favorite book as far as explaining all of this pointer/reference arithmetic?
    The C++ standard. But, since it has a tendency to cause an aneurysm in the unprepared mind, The C++ Programming Language will suffice for typical use.

    >pass by reference in its simplest form
    *shudder* Please look over the FAQ before posting code again.

    >I just tried your code in my VC5 compiler and didn't get any errors.
    Try working with the memory back in main when f returns. You'll probably get a run-time error.

    >I don't see why *& is used.
    It saves you the clutter of having to use a pointer to a pointer.

    >It looks sort of strange to me to.
    It looks strange to me and I'm used to using it. If your background is in C then references will feel funny for a long time.
    My best code is written with the delete key.

  2. #17
    Registered User
    Join Date
    Nov 2004
    Posts
    49
    Im just a beginner and I was the one not knowing hehe. but I think You interpreted the responces wrong.
    From what I can gather. we are not talking about classes copy constructors or classes at all.
    I could be wrong. But Copy as in Copying one variables value into anothers by assignment.
    like int i=7;
    int a=i;
    the value of i, 7, is now copied into a. Cause we assigned the value of i to a.
    I think we need the *& because Its just saying we are passing a Pointer by reference instead of value. So The function doesnt Copy the value by passing by Value. But Uses Reference instead.
    Thats what I got from it anyways. Lol someone just replyed says my email. Im always too late lOl Ill post this anyways

  3. #18
    Registered User
    Join Date
    Apr 2004
    Posts
    29

    not taken in a bad way

    Quote Originally Posted by Artist_of_dream
    Im just a beginner and I was the one not knowing hehe. but I think You interpreted the responces wrong.
    From what I can gather. we are not talking about classes copy constructors or classes at all.


    Sorry to interrupt your thread. I have all of these different sections of c/c++ running through my brain at the same time with not much order to it. I know you weren't talking about copy constructors, my comparison was only with the meaning of the word explicit; I also was not trying to tell anyone they were wrong, so my interpretation of the responses was for selfish reasons. I just printed out the FAQ on piointers and won't post until I've studied it thoroughly.


    Extremely rusty,
    ET

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 05:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 09:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 03:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 07:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21