![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Print * in place of characters for reading passwords in C
In this problem, we are given a string password. Our task is to print * in place of characters of the password.
Let’s take an example to understand the problem,
Input: password Output ********
To solve this problem, we will traverse the password we have entered and print * in place of characters of the password.
Example
The below program will show the implementation of our solution
#include <stdio.h> #include <string.h> int main() { char password[50] = "password"; int length = strlen(password); printf("Password : "); for(int i = 0; i<length; i++){ printf("*"); } return 0; }
Output
Password : ********
Advertisements