c语言密码有关问题

c语言密码问题
printf("\n");
for(j=0;j<3;j++)
{
   i=0;
   printf("请输入密码:\n");
   pw=getch();  //
   while(pw!='\r')                //
   {
  if(pw=='\b')//
   {
    printf("\b \b");//
    --i;            //
   }
  else 
   {
    putchar('*');   //
    atmtemp.password[i++]=pw;   //
   }
  pw=getch();   //
  }
   atmtemp.password[i]='\0';  //

   printf("\n");
   printf("请再次输入密码 ");                /*再次输入密码*/
   printf("\n");
   i=0;
   ch1=getch();
   while(ch1!='\r')
{

  if(ch1=='\b')
   {
   printf("\b \b");
   --i;
     }
  else 
   {
    putchar('*');
         ch[i++]=ch1;
   }
ch1=getch();
}
   ch[i]='\0';
   printf("\n");
   if(strcmp(atmtemp.password,ch)==0)                /*两次输入密码一样,继续*/
 {
strcpy(atm[No-1].zhanghao,atmtemp.zhanghao); /*创建新账号*/
strcpy(atm[No-1].password,atmtemp.password);


printf("---------------------\n");
printf("Information:\nID:%s\n",atm[No-1].zhanghao);
printf("---------------------\n");
No++;                              /*帐户自增*/
break;
}
    else printf("Please re-enter password.You have 3 times to try!\n");
  }
}
  else printf("Sorry, 没有此帐户.\n");
}
请大神指教,帮忙解释红色部分代码
密码

------解决方案--------------------
\b是退格的意思,\r是回到本行开始位置。

\r可以参考下我写的《C/C++ 在控制台下显示进度》
http://blog.csdn.net/morewindows/article/details/6742078
------解决方案--------------------
#include <conio.h>
#include <stdio.h>
char pw[40];
int i,ch;
FILE *f;
void main() {
    cprintf("\r\nPassword:");
    i=0;pw[i]=0;
    while (1) {
        ch=getch();
        if (ch==13 
------解决方案--------------------
 i>=39) break;
        switch (ch) {
        case 27:
            cprintf("\rPassword: %40s"," ");
            cprintf("\rPassword: ");
            i=0;pw[i]=0;