c语言中的printf函数
C语言中的printf()函数 (printf() function in C)
The printf() function is defined in the <stdio.h> header file.
在<stdio.h>头文件中定义了printf()函数 。
Prototype:
原型:
int printf(const char* str, . . .);
Parameters: const char* str, more optional parameters
参数: const char * str ,更多可选参数
Return type: int
返回类型: int
Use of function:
使用功能:
The printf() function writes the arguments which are written in the double inverted quotes, on the stdout stream. The prototype of the function printf() is int printf( const char* str, ...);
printf()函数将在双引号中写入的参数写入标准输出流。 函数printf()的原型是int printf(const char * str,...);
The string pointed by the str consists of two types of items. The first item is the data types which are printed on the screen and the second is the format of the data type. It returns the total number of characters printed or a negative value if an output error.
str指向的字符串包含两种类型的项目。 第一项是打印在屏幕上的数据类型,第二项是数据类型的格式。 它返回打印的字符总数,如果输出错误,则返回负值。
There are some formats of some data types is c,
有些格式的某些数据类型是c,
code Format %c Display Character%d Display signed integer number%f Display floating point number%ld Display double numbers %s Display string%p Display pointer%x Display hexadecimal numbers
C语言中的printf()示例 (printf() example in C)
#include <stdio.h>
int main(){
printf("Print a character - %c\n",'a');
printf("Print a number - %d\n",10);
printf("Print a decimal number - %f\n",5.25);
printf("Print a string - %s\n","hello");
return 0;
}
Output
输出量
翻译自: https://www.includehelp.com/c-programs/printf-function-in-c-language-with-example.aspx
c语言中的printf函数