Use pointers for strings - C String

C examples for String:char array

Description

Use pointers for strings

Demo Code

#include <stdio.h>
int main(void)
{
    const char * mesg = "this is a test!";
    const char * copy;
    /*www  .  java 2  s.  c  o  m*/
    copy = mesg;
    printf("%s\n", copy);
    printf("mesg = %s; &mesg = %p; value = %p\n", mesg, &mesg, mesg);
    printf("copy = %s; &copy = %p; value = %p\n", copy, &copy, copy);
     
    return 0;
}

Result


Related Tutorials