what is difference between getchar,putchar functions and
printf and scanf function? does putchar show output only
when input given to it

Answers were Sorted based on User's Feedback



what is difference between getchar,putchar functions and printf and scanf function? does putchar s..

Answer / jeevi

getchar is used to get only one character.. putchar is used
to print only one character.
printf can print more than one character,we can get more
than one variable by using scanf.

Is This Answer Correct ?    47 Yes 11 No

what is difference between getchar,putchar functions and printf and scanf function? does putchar s..

Answer / moses

getchar gets a character,printf prints the text,scanf read
the input,putchar prints the character of getchar....

Is This Answer Correct ?    11 Yes 4 No

what is difference between getchar,putchar functions and printf and scanf function? does putchar s..

Answer / akash kumar

getchar() reads one character from the "standard input",which is usually the user's keyboard. the syntax of the getchar() function is written as: character variable=getchar(). putchar() read's one character from the " standard output", which is usually the user's keyboard. the syntax of the putchar() function is written as : putchar ( character variable ). printf print the text , scanf reads the input ..... 

Is This Answer Correct ?    8 Yes 4 No

what is difference between getchar,putchar functions and printf and scanf function? does putchar s..

Answer / mudra

The standard C library provides several functions and macros for character 1/0. Here we consider the getchar and putchar macros. As these macros read or write a single character, they are typically used in a loop to read/write a sequence of characters.



A macro call is similar to a function call. Thus, it consists of a macro name followed by a comma-separated argument list enclosed in a pair of parentheses. If a macro does not require any arguments, the pair of parentheses must still be used.

The getchar macro is used to read a single character from the standard input stream, i. e., the keyboard. A call to get char takes the following form: getchar (). This macro waits until a key is pressed and then returns its value (after converting to integer). The value returned can be assigned to a variable of type char. However, note that this macro actually reads the data from the input buffer which is processed by program only when the Enter key is pressed. Thus, getchar does not return a value until the user presses the Enter key. As a result, it is not suitable for interactive programs. We can instead use the getch and getche functions which directly read the data from the keyboard.

The putchar macro is used to write a single character on the standard output stream (i.e., display). A call to this macro takes the following form: putchar (c), where c is an integer expression representing the character being written. Although this macro expects an argument of type int, we usually pass a character to it. The argument value (c) is converted to unsigned char and written to the standard output stream.

Is This Answer Correct ?    0 Yes 1 No

what is difference between getchar,putchar functions and printf and scanf function? does putchar s..

Answer / suji

getchar() gets only one character from the input.putchar
prints that character.printf prints the text that enter
within doublequotes.scanf gets morethan one input from
console.getchar & putchar gets&puts from & to file.

Is This Answer Correct ?    6 Yes 8 No

Post New Answer

More C Interview Questions

There is a practice in coding to keep some code blocks in comment symbols than delete it when debugging. How this affect when debugging?

0 Answers  


What is a 'null pointer assignment' error?

0 Answers  


plz answer....A program that takes 3 variables e.g a,b,c in as seperate parameters and rotates the values stored so that value goes a to b, b to c and c to a .

3 Answers  


What is the use of structure padding in c?

0 Answers  


What is meant by errors and debugging?

0 Answers  


main() { charx; while (x=0;x<=255;x++) printf("\nAscii value %d Character %c,x,x); }

2 Answers  


What is spark map function?

0 Answers  


plssssss help !!....using array.. turbo c.. create a program that will accept number of words to be consored. .a word must not exceed 10 characters long .the text to be entered will be no longer than 200 characters .there will be no 10 words example: enter number of words to be censor: 5 enter words to censor: windows office microsoft bill gates enter text to censor: bill gates founded microsoft and makes office and windows sample output: <consored> <censored> founded <censored> and makes <censored> and <censored>

1 Answers  


Write a program that accepts a string where multiple spaces are given in between the words. Print the string ignoring the multiple spaces. Example: Input: “ We Are Student “ Output: "We Are Student"

1 Answers  


What is this pointer in c plus plus?

0 Answers  


Write a program to swap two numbers without using third variable in c?

0 Answers  


cavium networks written test pattern ..

0 Answers   Cavium Networks,


Categories