[习题3]打印 printf

2018-07-05  本文已影响19人  AkuRinbu

使用教材

《“笨办法” 学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.
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
上一篇 下一篇

猜你喜欢

热点阅读