for(i=0;i<=9 &&(c=getchar())!=' ' && c!='\t' && c!='\n' &&c!=EOF;i++)
s[i]=c;
if(c==EOF)
flag=1;
While calling the storear function inside the main function, you are passing the flag value only.
So the variable flag becomes local in the storear function.