c语言实现的密码回写

#ifndef _GETPASSWD_H
#define _GETPASSWD_H

#include <stdio.h>
#include <conio.h>

char passwd[32] = "";

char *getPasswd()
{
    char c;
    int i = 0;
   
    while ((c=getch()) != '/r')
    {
        passwd[i++] = c;
        putchar('*');
    }
    passwd[i] = '/0';
   
    return passwd;
}
void main()
{
 char p[20];
 char *o=p;
 o=getPasswd();
 printf("/n");
 printf("%s",o);
 printf("/n");
}
#endif 

你可能感兴趣的:(c,语言)