Thread: Pointers - Is it the same?

  1. #1
    Unregistered
    Guest

    Question Pointers - Is it the same?

    When using pointers, are both statements below the same? (the part in bold)
    Code:
    int a;
    int *pointer;
    
    a = 5;
    
    
    /* do these both mean the same? */
    pointer = &a;
    pointer = a;
    
    Thanks.

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    No. The & operator returns the adress of a variable. The value of a var. and the adress of a var. is not the same thing.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

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