Thread: what is the difference between this??

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    49

    what is the difference between this??

    Hi all,
    Can anyone tell me, what is the diff between

    Code:
    char **maze
    char *buf
    w -> m
    diana --> programming is tough

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    char **maze is a pointer to a pointer to a char
    char *buf is a pointer to a char

    The w -> m I have no idea what you're referencing. It could be that w is a pointer to an instance of a struct and m is a member of that struct.
    If you understand what you're doing, you're not learning anything.

  3. #3
    Registered User
    Join Date
    Oct 2004
    Posts
    49
    ah i see, ya you are right, w is a reference to N which is a int in a struct

    what you mean by char **maze is a pointer to a pointer to a char.
    Can i say, maze ia a pointer that points to a char character.

    Same goes for the char *buf.
    buf is a pointer that points to a char character
    Last edited by dianazheng; 10-22-2004 at 07:34 PM.
    diana --> programming is tough

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by dianazheng
    what you mean by char **maze is a pointer to a pointer to a char.
    Can i say, maze ia a pointer that points to a char character.
    No. You can say: maze is a pointer to a pointer to a character. For every *, you have the words "pointer to a[n]". Thus:
    Code:
    int ****foo;
    This is worded as: "foo is a (*) pointer to a (*) pointer to a (*) pointer to a (*) pointer to an int.

    Quzah.
    Hope is the first step on the road to disappointment.

  5. #5
    ---
    Join Date
    May 2004
    Posts
    1,379
    a pointer to a pointer takes things one step further. By adding a pointer that points to a pointer(that points to a char) you can change what the first pointer is pointing to.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Finding the difference in two times
    By muthus in forum C++ Programming
    Replies: 4
    Last Post: 01-24-2008, 06:36 PM
  2. Difference Equations / Recurrence Relations
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 10-05-2007, 10:26 AM
  3. What's the difference between var++ and ++var
    By ulillillia in forum C Programming
    Replies: 6
    Last Post: 05-31-2007, 02:27 AM
  4. Replies: 6
    Last Post: 08-26-2006, 11:09 PM
  5. Difference between macro and pass by reference?
    By converge in forum C++ Programming
    Replies: 2
    Last Post: 02-26-2002, 05:20 AM