- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 : ********
- Related Articles
- What are reading and writing characters in C language?
- Print all permutations with repetition of characters in C++
- Ways to print escape characters in C#
- Print all distinct characters of a string in order in C++
- Print common characters of two Strings in alphabetical order in C++
- Print characters having odd frequencies in order of occurrence in C++
- Print characters and their frequencies in order of occurrence in C++
- Print consecutive characters together in a line in C++
- Print the arranged positions of characters to make palindrome in C Program.
- Queries for frequencies of characters in substrings in C++
- How to print duplicate characters in a String using C#?
- C program to print characters and strings in different formats.
- Encrypting Passwords in PHP
- Ways to print escape characters in python
- Function for Removing Forbidden Characters in C++

Advertisements