// Sample program using a pointer to manipulate character array #include #include #include #include int invalid(char *s1, char *s2); int main() { char pass[15]; clrscr(); cout << "Enter Password: "<< endl; gets(pass); if ( invalid(pass, "secret") ){ cout << "Unauthorized user!" << endl; getch(); exit(1); } cout << "Password validated!!!"; getch(); return 0; } int invalid(char *s1, char *s2) { while (*s1) if (*s1 - *s2) return *s1 - *s2; else{ s1++; s2++; } return 0; }