美文网首页
[习题3]打印 printf

[习题3]打印 printf

作者: AkuRinbu | 来源:发表于2018-07-05 10:43 被阅读19次

使用教材

《“笨办法” 学C语言(Learn C The Hard Way)》
https://www.jianshu.com/p/b0631208a794

Makefile

CFLAGS=-Wall -g
all: clean ex1 ex3

clean:
    rm  -f  ex1 ex3

ex3.c

#include <stdio.h>

int main()
{
    int age;
    int height = 72;

    printf("I am %d years old.\n",age);
    printf("I am %d inches tall.\n",height);

    return 0;
}

$

anno@anno-m:~/Desktop$ make all
rm  -f  ex1 ex3
cc     ex1.c   -o ex1
cc     ex3.c   -o ex3
anno@anno-m:~/Desktop$ ls
ex1  ex1.c  ex3  ex3.c  ex3.c~  Makefile  Makefile~

anno@anno-m:~/Desktop$ ./ex3
I am 0 years old.
I am 72 inches tall.
  • 查看 printfhelp
anno@anno-m:~$ man 3 printf

printf %d %s

https://en.cppreference.com/w/c/io/fprintf

Escape sequences

https://en.cppreference.com/w/c/language/escape

Escape sequences.PNG

ASCII Chart

https://en.cppreference.com/w/c/language/ascii

ASCII Chart.PNG

相关文章

  • [习题3]打印 printf

    使用教材 《“笨办法” 学C语言(Learn C The Hard Way)》https://www.jiansh...

  • printf打印与syslog日志

    printf的归宿-数据打印到哪儿了-1 printf的归宿-数据打印到哪儿了-2 source

  • C语言陷阱

    1、当我们使用 printf 打印字符串时,要用 printf("%s", s ); 而不能用 printf( s...

  • printf和sprintf的区别

    一、printf和sprintf的区别sprintf函数打印到字符串中,而printf函数打印输出到屏幕上。spr...

  • C语言基础知识:printf的输出格式,C/C++语言编程讲解

    C语言基础知识:printf的输出格式 printf()函数是格式输出函数,请求printf()打印变量的指令取决...

  • 练习题1

    练习使用printf()函数 1、利用printf()函数进行简单的输出 2、打印出简单的字符 打印一个字母A 打...

  • C 关于printf scanf的返回值的问题思考

    printf返回值的思考 其输出结果为 过程:printf先将43打印出来,然后最右边的printf返回2,对应第...

  • printf与sprintf的区别

    printf函数: 把文字格式化以后输出,如: sprintf函数: 跟printf相似,但不打印,而是返回格式化...

  • printf总是打印0

    好久没用 c 的 printf 输出了,然后今天调程序就遇到了一个奇怪的错误,如下: 输出结果如下: 想了好久都没...

  • 一些虚拟机的命令

    /* 。。 /中间不能再加/*/. printf全称:print formatter格式化打印for...

网友评论

      本文标题:[习题3]打印 printf

      本文链接:https://www.haomeiwen.com/subject/ewbuuftx.html