String copy: assign the pointer value : String Copy « String « C / ANSI-C






String copy: assign the pointer value

  
#include <stdio.h>
#include <string.h>

int main(void)
{
  char *p = "stop";
  char str[80];

  do {
   printf("Enter a string: ");
   gets(str);
  } while(strcmp(p, str));

  return 0;
}


           
       








Related examples in the same category

1.how to use strcpy (string copy)
2.A simple string copy
3. Copy string: how to use strcpy
4. Copy characters from one string to another: how to use strncpy
5.Copy a string