answersLogoWhite

0

What is putchar function in c?

Updated: 8/10/2023
User Avatar

Wiki User

6y ago

Best Answer

putchar used to write one character to output device Example putchar (variable_name); #include<stdio.h> void main() { char alpha='x'; clrscr(); putchar(alpha); putchar('\n'); /*or*/ putchar('\Y'); getch(); }

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

6y ago

The putchar function is an unformatted console output function that displays (in VDU) only one ascii character being passed to them. Examples being passed are:

1. putchar(65); // displays 'A' in monitor.

2. putchar('A'); // displays 'A' in monitor.

Note that only integer (decimal) can be passed in void _cdecl putchar(int _C); ranging from 0 to 255 (compliant to ASCII) or the character enclosed with ' '.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is putchar function in c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you skip a line in C program?

putchar ('\n');


How do you print double quote sign in c?

putchar ('"'); puts ("""); etc


How will you print percent in c language?

putchar ('%'); puts ("%"); printf ("%%"); etc...


How printf function is used within a C program and is different from putchar function?

1. use the help/manual 2. entirely different: put one character vs put string with formatted inserts


What loops does not need a counter?

Random example: while ((c= getchar()) != EOF) putchar (c);


What is the printf in c?

Printf is a function which can output a "string literal," which means that unlike its similiar, putchar, it can in fact print entire sentences, including formatted data. Also, it's defined in stdio.h.


Input and output of turbo c?

input scanf() , getch() , getche() output printf() , putch() , putchar()


What are the differences between puts and fputs?

All three functions output a single character, either to the console or to a FILE. putc() takes a character argument, and outputs it to the specified FILE. fputc() does exactly the same thing, and differs from putc() in implementation only. Most people use fputc(). putchar() writes the character to the console, and is the same as calling putc(c, stdout). puts() is a multicharacter function and putchar() is single character function


Functions except gets and puts in c?

printf , scanf , getchar, putchar, getc are the other operators in C except gets and puts..


How do you print a string using putchar?

You would iterate over all characters within the string, printing each character with the putchar function. In C, strings are terminated with a null byte, so you'd stop when that null byte has been reached. Example: void printme(const char* me) { while (*me) { putchar(*me++); } } Needless to say this method is inefficient compared to using API that outputs the entire string at once, but the general approach of iterating over all characters in a string is used frequently.


How do you print on console without using printf or puts in c language?

write, putchar, putc, fputc etc


How do you convert binary to decimal using c?

static void tobin_core (int n) { if (n&gt;1) tobin_core (n/2); putchar ('0'+n%2); } void tobin (int n) { if (n&lt;0) { putchar ('-'); n= -n; } tobin_core (n); }