Thanks for the help everyone. I have managed to get some output from the program. It helped me clear some concepts.
Code:
#include <stdio.h>
#include <stdlib.h>
int main(void) {
const char msg[15] = "blueberry";
int c;
char s[15];
int j = 0;
int i = 0;
int nomatch = 0;
while (i < 15 && (c = getchar()) != '\n')
{
s[i] = (char) c;
++i;
}
s[i] = '\0';
printf("input: %s\n", s);
printf ("value of i %d",i);
printf("\nmessg: %s\n", msg);
for (i=j=0; s[i] != '\0'|| msg[i] != '\0';)
{
nomatch = 0;
if (s[i] != msg[i])
{
nomatch = 1;
}
if (nomatch == 1)
{
s[j] = s[i];
j++;
}
++i;
}
s[j] = '\0';
printf ("output: %s ", s);
}