kevin-ja-lin / tcpl Goto Github PK
View Code? Open in Web Editor NEWThis project forked from anotherlin/tcpl
Solutions for "The C Programming Language", 2nd Edition, Kernighan and Ritchie
This project forked from anotherlin/tcpl
Solutions for "The C Programming Language", 2nd Edition, Kernighan and Ritchie
Solutions for "The C Programming Language", 2nd Edition, Kernighan and Ritchie. Lin Ke-Fong ([email protected]) I read the book a while ago and did most of the exercises, this was a copy from my university's library. When I finally bought it, I figure out it would be fun to do them all seriously. The solutions are written trying to use the same style as the book. They follow chapter ordering and try not to use features described later. I have developed them using Linux and gcc but they have also been tested on Mac OS X and Windows using XCode and Visual C++. Exercises are command line oriented, taking inputs from file redirection most of the time. When possible, you should compile in strict ANSI mode, with all warnings on and maximum optimization. Warnings even if sometimes more annoying than really useful, may still point genuine problems. A lot of exercises are about writing simplified or even full versions of C standard library functions. Hence there can be clashes at compilation or linking. Compiling in strict ANSI mode will avoid most problems, even if the compiler or linker may still continue to complain a bit. On BSD systems and Mac OS X (Darwin is a BSD), you will also need to define the _ANSI_SOURCE macro. Moreover, there can still be issues with intrinsic (built-in) functions: warnings for gcc but you will have to switch them off with Visual C++. Enabling optimizations permit further error checking as the compiler does a more detailed dataflow analysis. However, floating-point computations (exercise 2-1) may end up wrong depending of the compiler and processor. Here are some examples of compilation commands: GNU C: gcc -ansi -Wall -pedantic -O3 GNU C (BSD or Mac OS X): gcc -ansi -Wall -pedantic -D_ANSI_SOURCE -O3 Intel C Compiler: icc -strict-ansi -w2 -fast Microsoft Visual C (no intrinsic): cl /Ox /Oi- /Za /Wall See compilers' manuals for full details. Exercises of chapter 8 won't compile at all with Visual C++. However, you can make the first four of them work by commenting the unistd.h includes. You may also want to check "The C Answer Book" by Clovis L. Tondo and Scott E. Gimpel. Or the website maintained by Richard Heathfield: http://users.powernet.co.uk/eton/kandr2/ To end up, I wish to thank all my friends and relatives.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.