BEGINNING WITH C – INPUT-OUTPUT IN C LANGUAGE

BEGINNING WITH C LANGUAGE

2. putchar()

Basically, putchar() function is a file handling function in C language. Furthermore, we use putchar() function to write a character on standard output.

In-short, putchar() function outputs one character at a time to the standard output.

Further, the syntax of putchar() function is..

int putchar(int char);

Now, Following is the example of putchar() function –

#include<stdio.h>

#include<conio.h>

void main()

{

clrscr();

char ch;

printf(“ENTER ANY CHARACTER – “);

ch=getchar();

printf(“THE CHARACTER IS – “);

putchar(ch);

getch();

}

OUTPUT –

ENTER ANY CHARACTER – M

THE CHARACTER IS – M 

 

3. putch()

Now, similar to getch() function.. Function putch() is also a non-standard function. Further, this function is also present in header file “conio.h“. Also, like getch(), This is mostly applicable in compilers like Turbo C.

Basically, we use putch() function to write a character to the output screen. Also, the function putch() displays alpha-numeric characters to the standard output device. Also, It displays only one character at a time.

Further, the syntax of putch() function is..

putch(variable_name);

Now, Following is the example of putch() function –

#include<stdio.h>

#include<conio.h>

void main()

{

clrscr();

char ch=’M’;

putch(ch);

}

OUTPUT –

M

 

Therefore, it was all about THE BEGINNING WITH C – INPUT-OUTPUT IN C LANGUAGE..

Also, as we all know that a Good beginning makes a Good ending. Thus, It is the necessity to have a good start and for that keep learning, acknowledging, practising and applying..

Leave a comment

Your email address will not be published. Required fields are marked *