SHARE
TWEET

Untitled

a guest Dec 16th, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. #include<cstring>
  3. using namespace std;
  4.  
  5. char * locate( char * needle,  char * haystack)
  6. {
  7.     char*p;
  8.     for (int i = 0; i < strlen(haystack); i++)
  9.     {
  10.  
  11.         if (*(haystack + i) == *(needle + i))
  12.         {
  13.            
  14.             cout << *(haystack + i);
  15.         }
  16.  
  17.  
  18.  
  19.     }
  20.     return 0;
  21.  
  22. }
  23.  
  24. int main()
  25. {
  26.     char *p;
  27.     char a[] = "hell";
  28.     char b[] = "oh my hello";
  29.  
  30.     p = locate(a, b);
  31.  
  32.     cout << endl;
  33.     cout << &p;
  34.  
  35.     system("pause");
  36.     return 0;
  37. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top