I have program that asks to enter a string (mystring) and a char (ch). Then it deletes all entered chars (ch) from the string (mystring). For example "abcabc" and char 'a' then the result shoud be "bcbc". -When I use scanf the program works nicely if the string does not have spaces. If I enter "abc abc abc" It reads and processes only the first 3 letters (until space). Then I was advised to use gets(mystr); because it can read all the stirng. But when I use gets the result is the same as the input string and nothing happens.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 100
int main(int argc, char *argv[])
{
   char mystr[N] ,result[N];
   char ch;
   int i,k;
   k=0;
   printf("enter string \n");   
   //gets(mystr);///////////////////////////
   //scanf("%s",&mystr);///////////////////
   printf("enter char \n");  
     scanf("%c",&ch);
     scanf("%c",&ch);
  for ( i = 0; i <= strlen(mystr); i++ )
  {
    if (mystr[i] != ch)
    {
      result[k]=mystr[i];
      k++;
    } 
  }
   puts(result);
   system("pause");
   return 0;
}
 
     
     
     
    