博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux C print
阅读量:5320 次
发布时间:2019-06-14

本文共 1771 字,大约阅读时间需要 5 分钟。

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 Character Displays Argument (Variable's Contents) As
%c Single character
%d Signed decimal integer (int)
%e Signed floating-point value in E notation
%f Signed floating-point value (float)
%g Signed value in %e or %f format, whichever is shorter
%i Signed decimal integer (int)
%o Unsigned octal (base 8) integer (int)
%s String of text
%u Unsigned 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

 
Sequence Meaning
\a Beeps the speaker
\b Backspace (moves the cursor back, no erase)
\f Form feed (ejects printer page; may clear the screen on some computers)
\n Newline, like pressing the Enter key
\r Carriage return (moves the cursor to the beginning of the line)
\t Tab
\v Vertical tab (moves the cursor down a line)
\\ The backslash character
\' The apostrophe
\" The double-quote character
\? The question mark
\0 The "null" byte (that's 0, not the letter O)
\Onn A character value in octal (base 8)
\xnnn A 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

你可能感兴趣的文章
C#类与结构体究竟谁快——各种函数调用模式速度评测
查看>>
我到底要选择一种什么样的生活方式,度过这一辈子呢:人生自由与职业发展方向(下)...
查看>>
一些有意思的算法代码[转载]
查看>>
poj 题目分类
查看>>
windows 安装yaml支持和pytest支持等
查看>>
读书笔记:季羡林关于如何做研究学问的心得
查看>>
面向对象的优点
查看>>
套接口和I/O通信
查看>>
阿里巴巴面试之利用两个int值实现读写锁
查看>>
@bzoj - 3750@ [POI2015] Pieczęć
查看>>
PHP定时任务
查看>>
浅谈性能测试
查看>>
Winform 菜单和工具栏控件
查看>>
jequery动态创建form
查看>>
CDH版本大数据集群下搭建的Hue详细启动步骤(图文详解)
查看>>
第六次java作业
查看>>
巧用Win+R
查看>>
浅析原生js模仿addclass和removeclass
查看>>
Python中的greenlet包实现并发编程的入门教程
查看>>
tweenlite使用说明
查看>>