summaryrefslogtreecommitdiff
path: root/usr.bin/learn/lib/C/L1.1d
blob: 1ee669389d0e9080e3d86a2bf7b3b421da36aa0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#print
(Section 1.1)
Write a program which prints these four lines,
exactly as shown:
A tab is \t
A backspace is \b
A quote is \"
A backslash is \\

Compile it, test it, then type ready.
#once #create Ref
A tab is \t
A backspace is \b
A quote is \"
A backslash is \\
#user
a.out >x
#cmp x Ref
#succeed
One solution:

main()
{
	printf("A tab is \\t\n");
	printf("A backspace is \\b\n");
	printf("A quote is \\\"\n");
	printf("A backslash is \\\\\n");
}
#fail
Watch out for those backslashes.
#log
#next
1.1e 10