pointers

This is a discussion on pointers within the C Programming forums, part of the General Programming Boards category; is int *p; p=&i; same as *p=&i...

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    11

    pointers

    is
    int *p;
    p=&i; same as *p=&i

  2. #2
    Registered User
    Join Date
    Mar 2008
    Location
    slovenia
    Posts
    25
    No.
    Code:
    int *p;
    int a;
    p = &a;
    *p = 20; // as if you said a = 20;

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    11
    Quote Originally Posted by Crazed View Post
    No.
    Code:
    int *p;
    int a;
    p = &a;
    *p = 20; // as if you said a = 20;
    according u urs program a is equal to 20

  4. #4
    Super unModrator
    Join Date
    Dec 2007
    Posts
    321
    Code:
    p=&i;
    This means value of p = address of i

    Code:
    *p=&i
    value at the memory location where p is pointing to = address of i

    http://www.learncpp.com/cpp-tutorial...n-to-pointers/

Popular pages Recent additions subscribe to a feed

Similar Threads

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

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