linux C print

4.1.1.The printf Function

  1. printf displays information on screen.
  2. printf returns the number of characters printed.
  3. printf displays the text you put inside the double quotes.
  4. printf requires the backslash character - an escape sequence - to display some special characters.
  5. printf can display variables by using the % conversion character.
  6. printf format: a string argument followed by any additional arguments.

4.1.2.The printf() Conversion Characters and flags

 
Conversion CharacterDisplays Argument (Variable's Contents) As
%cSingle character
%dSigned decimal integer (int)
%eSigned floating-point value in E notation
%fSigned floating-point value (float)
%gSigned value in %e or %f format, whichever is shorter
%iSigned decimal integer (int)
%oUnsigned octal (base 8) integer (int)
%sString of text
%uUnsigned decimal integer (int)
%x

Unsigned hexadecimal (base 16) integer (int)

4.1.3.Placeholders

The general form of a placeholder is: % flags field-width precision prefix type-identifier.

4.1.5.printf() Escape Sequences

 
SequenceMeaning
\aBeeps the speaker
\bBackspace (moves the cursor back, no erase)
\fForm feed (ejects printer page; may clear the screen on some computers)
\nNewline, like pressing the Enter key
\rCarriage return (moves the cursor to the beginning of the line)
\tTab
\vVertical tab (moves the cursor down a line)
\\The backslash character
\'The apostrophe
\"The double-quote character
\?The question mark
\0The "null" byte (that's 0, not the letter O)
\OnnA character value in octal (base 8)
\xnnnA character value in hexadecimal (base 16)

 

4.2.1.c: convert value to unsigned char and display

 

#include <stdio.h>
main()
{
    int i = 100;
    printf(" %c\n",i);
}

 

转载于:https://www.cnblogs.com/shixinzhu/archive/2012/02/10/2345005.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值