Home > Backend Development > C#.Net Tutorial > What is the difference between putchar and printf

What is the difference between putchar and printf

青灯夜游
Release: 2022-12-30 11:13:19
Original
18827 people have browsed it

Difference: The putchar() function can only output a single character, while the printf() function can output various types of data, such as character, floating point, and integer types; "printf("%c", 'A')" is equivalent to "putchar('A')". If you only want to output one character, putchar() is better to use.

What is the difference between putchar and printf

The operating environment of this tutorial: windows7 system, c99 version, Dell G3 computer.

In C language, there are three functions that can be used to output data on the display. They are:

  • ##puts(): can only output strings, and Line breaks will occur automatically after the output is completed, which has been introduced in "The First C Language Program".

  • putchar(): can only output a single character

  • printf(): can output various types of data, such as %d %f %lf %s can be used


  • ##There is no comparison between putchar and printf, each has its own function

such as
printf("%c ",'A')
is equivalent to putchar('A');For more computer programming related knowledge, please visit:

Programming Video

! !

The above is the detailed content of What is the difference between putchar and printf. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template