You really need to work on the indentation. It's difficult to read.
You need to start using proper variable names, n & m means nothing to me.
And for the love of the gods, do not use implicit main: http://cpwiki.sourceforge.net/Implicit_main
This is how a proper indented code should look like:
(This is an old code of yours, btw.)
Code:
#include <stdio.h>
#include <string.h>
#include <windows.h>
#include <stdlib.h>
int main()
{
char input1[100], input2[100];
char *p,*q; // Don't need these
char checker[100];
int i,j,n,m; // n & m are very poor variable names
printf("Please enter a string : ");
fgets(input1, 100, stdin); // 100 should be sizeof(input1) instead
printf("Please enter the code : ");
fgets(input2, 100, stdin);n // Same as first fgets
// Unnecessary
p = input1;
q = checker;
// Use better variable names
n = strlen(input1);
m = strlen(input2);
// Causes bug
m = m-1;
n = n-1;
for(i=0;i<n;i++) // Use better variable names!
{
for(j=0;j<m;j++) // Use better variable names!
{
checker[j] = input1[i+j];
}
printf("%s\n%s\n",checker,input2);
if (strcmp(checker,input2) == 0)
printf("Matched at %d\n", i+1);
}
system("pause");
}