const char *p;

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mabelline
    New Member
    • Mar 2007
    • 1

    const char *p;

    Which of the choices is true for the mentioned declaration ?

    const char *p;

    and

    char * const p;

    a) You can't change the character in both

    b) First : You can't change the characterr &

    Second : You can;t change the pointer

    c) You can't change the pointer in both

    d) First : You can't change the pointer &

    Second : You can't chanage the character

    e) None
  • horace1
    Recognized Expert Top Contributor
    • Nov 2006
    • 1510

    #2
    Originally posted by mabelline
    Which of the choices is true for the mentioned declaration ?

    const char *p;

    and

    char * const p;

    a) You can't change the character in both

    b) First : You can't change the characterr &

    Second : You can;t change the pointer

    c) You can't change the pointer in both

    d) First : You can't change the pointer &

    Second : You can't chanage the character

    e) None
    try writing a small test program and attempt to change the character pointed to and the pointer and see what happens

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      Originally posted by mabelline
      Which of the choices is true for the mentioned declaration ?

      const char *p;

      and

      char * const p;

      a) You can't change the character in both

      b) First : You can't change the characterr &

      Second : You can;t change the pointer

      c) You can't change the pointer in both

      d) First : You can't change the pointer &

      Second : You can't chanage the character

      e) None
      What do you think is correct?

      P.S Renamed thread.

      Comment

      Working...