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 numbersC語言中的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函數
總結
以上是生活随笔為你收集整理的c语言中的printf函数_C语言中的printf()函数与示例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Java中那些内存泄漏的场景!
- 下一篇: Java ObjectInputStre