title: When I remove the scanf line from this code then I get the correct ouput as "hello" but on using scanf I get the output as "bye".... Why so?
body: <p>This code produces correct output without scanf line. The function returns different value on using scanf. Why so??</p>
  
  <pre><code> int main()
   {
   int choice;
   scanf("%d",&amp;choice);
   bool a=admi_login();
   if(a==true)
      printf("\n hello");
   else
      printf("Bye");
   }   
  bool admi_login()
  {
  printf("Enter the Admin Password\n");
  char pw[100];
  int i;
  for(i=0;i&lt;=100;i++)
  {
      pw[i]=getch();
      if(pw[i]=='\r')
          break;
      printf("*");
  }
  char pw1[100]="admin\r";
  if((strcmp(pw,pw1))==0)
    return true;
  else
   return false;}
  </code></pre>