Thread: pointers!!!

  1. #16
    Registered User billholm's Avatar
    Join Date
    Apr 2002
    Posts
    225
    HELLO SHADOW!!!
    All men are created equal. But some are more equal than others.

    Visit me at http://www.angelfire.com/my/billholm

  2. #17
    Registered User newbie_grg's Avatar
    Join Date
    Jul 2002
    Posts
    77

    now !!

    i ask you straightly . can you help me?? i dont think you are eligible to help!!
    "If knowledge can create problems, it is not through ignorance that we can solve them. "
    -Isaac Asimov(1920-1992)

  3. #18
    Registered User newbie_grg's Avatar
    Join Date
    Jul 2002
    Posts
    77
    that was for shadow!
    "If knowledge can create problems, it is not through ignorance that we can solve them. "
    -Isaac Asimov(1920-1992)

  4. #19
    Registered User billholm's Avatar
    Join Date
    Apr 2002
    Posts
    225

    Talking

    Well...

    Your algorithm for swapping seems okay, but you are not coding it properly. I think the others already presented the correct codes for you. You should try them and tell the difference between what you did and how the others did it. You can't learn if you don't analyze the problem.
    All men are created equal. But some are more equal than others.

    Visit me at http://www.angelfire.com/my/billholm

  5. #20
    Registered User billholm's Avatar
    Join Date
    Apr 2002
    Posts
    225
    Okay how about this:

    In order to swap the values, you should not dereference the variables.

    int *a, *b, *c;

    what you did was like this: c = a; you are swapping the addresses but not necessarily the values. You should have done this *c = *a; this way you will surely get what you want.

    I'm not sure if I have explained this quite accurately, but I'm sure this is the main idea.
    All men are created equal. But some are more equal than others.

    Visit me at http://www.angelfire.com/my/billholm

  6. #21
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    > HELLO SHADOW!!!
    Oh no! They let the trolls out again!
    I'm outta here..
    The world is waiting. I must leave you now.

  7. #22
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > can you help me??
    We have - study the first post from The Dog

    If you want to output inside the swap function, try
    cout << "new value of a is " << *a << endl;

  8. #23
    Registered User billholm's Avatar
    Join Date
    Apr 2002
    Posts
    225
    >>Oh no! They let the trolls out again!
    I'm outta here..<<


    Oh cmon Shadow Don't go just now... You can't imagine what I have gone through...

    I had to endure these past few weeks of boredom because I really missed your stupidity HWAHAHAHAHAHAHAHAHAHAHAHA!!!
    Last edited by billholm; 08-04-2002 at 09:38 PM.
    All men are created equal. But some are more equal than others.

    Visit me at http://www.angelfire.com/my/billholm

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. MergeSort with array of pointers
    By lionheart in forum C Programming
    Replies: 18
    Last Post: 08-01-2008, 10:23 AM
  2. Using pointers to pointers
    By steve1_rm in forum C Programming
    Replies: 18
    Last Post: 05-29-2008, 05:59 AM
  3. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  4. Staticly Bound Member Function Pointers
    By Polymorphic OOP in forum C++ Programming
    Replies: 29
    Last Post: 11-28-2002, 01:18 PM