c语言中的printf函数_C语言中的printf()函数与示例

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

输出量

printf() example in C language

翻译自: https://www.includehelp.com/c-programs/printf-function-in-c-language-with-example.aspx

c语言中的printf函数

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值