Putchar function : Displaying String in C Programming
Syntax :
Way 1 : Taking Character as Parameterint putchar(int c);
putchar('a') ; // Displays : a
- Individual Character is Given as parameter to this function.
- We have to explicitly mention Character.
putchar(a); // Display Character Stored in a
- Input Parameter is Variable of Type "Character".
- This type of putchar() displays character stored in variable.
putchar(a[0]) ; // Display a[0] th element from array
- Character Array or String consists of collection of characters.
- Like accessing individual array element , characters can be displayed one by one using putchar().
#include< stdio.h> #include< conio.h> void main() { char string[] = "This is an example string\n"; int i=0; clrscr(); while(string[i]!='\0') { putchar(string[i]); i++; } getch(); }
What it Does ?
- Display String Character by Character
- Header File : stdio.h
- Putchar is a macro that outputs a character on stdout.
- How to Input Password in C : Validation of User name
- Putchar function >> Displaying String in C
- Puts >> Displaying String in C Programming
- Printf >> Displaying String in C Programming

0 comments
Post a Comment
Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email