File:  [CSRG BSD Unix] / 43BSDTahoe / usr.lib / learn / C / L1.1b
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:58 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43tahoe
BSD 4.3tahoe

#print
(Section 1.1)
Now write a C program that prints two lines,
the first of which says "hello" and the second
"goodbye".  Don't forget those \n delimiters.
Compile and test it.  When satisfied,
type "ready".
#once #create Ref
hello
goodbye
#user
a.out >test
#cmp test Ref
#succeed
Here is one possible solution to compare against yours.

main()
{
	printf("hello\n");
	printf("goodbye\n");
}

You could also combine the two messages into one
call to printf, like

	printf("hello\ngoodbye\n");

but this is harder to read at a glance.
#log
#next
1.1c 10

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.