? about char somearray[] and char *somearray[]

This is a discussion on ? about char somearray[] and char *somearray[] within the C++ Programming forums, part of the General Programming Boards category; Hi, I have a quick question about arrays, I have an array: char somearray[]. I understand it keeps a pointer ...

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    15

    ? about char somearray[] and char *somearray[]

    Hi,

    I have a quick question about arrays, I have an array:

    char somearray[]. I understand it keeps a pointer to the first element.

    I have also run across :

    char *somearray[], what exactly does this mean?? It is a pointer to a pointer to the first element of the array??


    Thanks for any clarification anyone can provide!!

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >char somearray[]. I understand it keeps a pointer to the first element.
    When used in an expression, the name of the array becomes a pointer to the first element, but it's not always a pointer to the first element.

    >char *somearray[], what exactly does this mean?? It is a pointer to a pointer to the first element of the array??
    [] binds tighter than *, so this is an array of pointers to char. A pointer to an array of char is char (*parray)[]
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sorting Linked Lists
    By DKING89 in forum C Programming
    Replies: 6
    Last Post: 04-09-2008, 08:36 AM
  2. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 05:42 PM
  3. Replies: 7
    Last Post: 06-16-2006, 10:23 PM
  4. Obtaining source & destination IP,details of ICMP Header & each of field of it ???
    By cromologic in forum Networking/Device Communication
    Replies: 1
    Last Post: 04-29-2006, 03:49 PM

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