next up previous
Next: Pointer - Up: Pointer-Arithmetik Previous: Pointer +

Pointer + int (forts.)

char *strcpy(char *s1, const char *s2)
{
  char *tmp = s1;
  while (*s2 != '\0')
    *(tmp++) = *(s2++);
  *tmp = '\0';
  return(s1);
}

main(int argc, char **argv)
{
  char u[255];
  
   if (argc != 3)
   {
     cerr << "Usage: " <<  argv[0] 
       << ": string1 string2" <<endl;
     exit(1);
   }
   cout << strcmp(argv[1], argv[2]) << endl;

   strcpy(u, argv[1]);
   cout << u << endl;
}


next up previous
Next: Pointer - Up: Pointer-Arithmetik Previous: Pointer +

© 1997 Gottfried Rudorfer, C++-AG, Lehrveranstaltungen, Abteilung für Angewandte Informatik, Wirtschaftsuniversität Wien, 3/19/1998