Re: another const question

Discussion in 'C Programming' started by Ben Pfaff, Jun 29, 2003.

  1. Ben Pfaff

    Ben Pfaff Guest

    (Felix Zaslavskiy) writes:

    > given :
    >
    > char c[] = "hello";
    >
    > Can one say that c is type of const char * ?


    As others have already said, no, if your question is to be
    interpreted literally. However, I suspect you really mean, "Can
    I use expression `c' as the argument for a parameter of type
    `const char *'?" If that's your real question, the answer is
    "yes". For instance, you could pass `c' as either argument to
    the strstr() function.
    --
    int main(void){char p[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.\
    \n",*q="kl BIcNBFr.NKEzjwCIxNJC";int i=sizeof p/2;char *strchr();int putchar(\
    );while(*q){i+=strchr(p,*q++)-p;if(i>=(int)sizeof p)i-=sizeof p-1;putchar(p\
    );}return 0;}
     
    Ben Pfaff, Jun 29, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    11
    Views:
    1,108
  2. Javier
    Replies:
    2
    Views:
    567
    James Kanze
    Sep 4, 2007
  3. 0m
    Replies:
    26
    Views:
    1,123
    Tim Rentsch
    Nov 10, 2008
  4. fungus
    Replies:
    13
    Views:
    892
    fungus
    Oct 31, 2008
  5. Replies:
    2
    Views:
    542
    Andrew Koenig
    Feb 9, 2009
Loading...

Share This Page