fork download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. char szNeedle[]={"tweedle"};
  6. char szHaystack[]={"poor little stanley tweedle lost in lyekka's haystack"};
  7. char* pNeedle=0;
  8.  
  9. if (pNeedle=strstr(szHaystack, szNeedle))
  10. {
  11. printf("found %s", pNeedle);
  12. }
  13.  
  14. if (pNeedle=strstr(szNeedle, szHaystack))
  15. {
  16. printf("found %s", pNeedle);
  17. }
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0.01s 1720KB
stdin
Standard input is empty
stdout
found tweedle lost in lyekka's haystack