So, in an effort to solve this problem, I'm trying to get how Strings work in relation to pointers.

Code:
#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.");
  scanf("%s", msg1);
  printf("Good, now please enter the second string.");
  scanf("%s", msg2);
  int count = 0;


for( str1 != '\0' ;; str1++)
{
  printf("[%s]", str1);


  if(str1 == '\0')
    break;


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


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




}


}
So, I'm trying to start small and make my program effectively return the line of a string.

that second string is returned when the strstr() method isn't null and when strstr() isn't null, then my program should iterate further in the first string according the the value of the second string and keep iterating.

So if I type Matt\nBooty\nMattBooty\nMatt\nBooty in string a and type Booty in string B, it should tell me which line Booty appears on

since my code should iterate every time \n is found in the string. However, it seems that my code doesn't adhere to those principles, because even though I made it so that when \n appears in the string that count would increase, it doesn't seem to do anything.

Furthermore, the string doesn't seem to have '\0' or a null termination character at the end.

What my code ends up showing is this: the string BootyMattBootyMattBootyMattBooty is on line 0[ootyMattBootyMattBootyM - Pastebin.com

What did I do wrong here?