String problem

Discussion in 'C' started by singh_r85, May 31, 2010.

  1. singh_r85

    singh_r85 New Member

    Joined:
    May 25, 2010
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    0
    What is the difference between char a[] = "string"; and
    char *p = "string"; ?
     
  2. pkbis28

    pkbis28 New Member

    Joined:
    May 25, 2010
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    0
    The first declares an initialized and modifiable array; the
    second declares a pointer initialized to a not-necessarily-
    modifiable constant string.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice