C – Unformatted Output Function

Preview
You must first complete Read values in C- scanf() function before viewing this Lesson

C – Unformatted Output Function

Unformatted output functions provided by C are :


 1. putchar()

This function is used to display value of a character variable or constant. The header file required is <stdio.h>.

Program to demonstrate putchar()
#include<stdio.h>
int main()
{
char n=’K’;
printf(“\ncharacter=”);
putchar(n);
return (0);
}
Output
character=K



2. putch()

It is also used to display value of a character variable or constant. The header file required for this function is <conio.h>.

Program to demonstrate putch()
#include<stdio.h>
#include<conio.h>
int main()
{
char n=’K’;
printf(“\ncharacter=”);
putch(n);
return (0);
}
Output
character=K



3. puts()

It is used to display the value of a string variable or string constant on the screen. The header file required for this function is <stdio.h>.

Program to demonstrate puts()

#include<stdio.h>
int main()
{
char sname[20]=”Amit”;
puts(“\nName is”);
puts(sname);
return (0);
}
Output

Nameis

Amit

Best Books of C



Spread the love
Lesson tags: putch function of c, putchar function of c, puts function of c
Back to: C Programming Language
Spread the love