Untitled

                Never    
C
       
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>

#define MAX 1000

int main()
{
  char *str1, *str2;
  char msg1[MAX], msg2[MAX];
  char* loc;


  str1 = msg1;
  str2 = msg2;
  printf("Please enter the first string.");
  msg1[1] ='\0';
  scanf("%s", msg1);
  printf("Good, now please enter the second string.");
  msg2[1] ='\0';
  scanf("%s", msg2);
  int count = 0;

for(int i = 0; i < MAX; i++)
{

  //str1[sizeof(msg1)] = '\0';
  printf("[%s]", str1);

  if(str1[i] == '\0')
    break;

  else if((loc = strstr(str1, str2)) != NULL)
  {
    printf("\n\nthe string %s is on location %d",str1, str1 - str2 - MAX);
    str1 += sizeof(str2);
    if(str1 == '\n')
      count++;

  }

  else if(str1 == '\n')
    count++;


}

}

Raw Text