## 7 янв. 2013 г.

### Head First C - David Griffiths

Exit status of last program
echo \$?

&x - location in memory of x variable

You can also call sizeof for a data type, such as sizeof(int).

You can declare a char pointer as const char * to prevent the code from using it to modify a string.

man strstr
info coreutils 'printf'

Q: But what if I want to pass negative numbers as command-line arguments like set_temperature -c -4? Won’t it think that the 4 is an option, not an argument?
A: In order to avoid ambiguity, you can split your main arguments from the options using --. So you would write set_temperature -c -- -4. getopt() will stop reading options when it sees the --, so the rest of the line will be read as simple arguments.

(./bermuda | ./geo2json) < spooky.csv > output.json

If you genuinely want to share variables, you should declare them in your header file and prefix them with the keyword extern:
extern int passcode;

make takes away a lot of the pain of compiling files. But if you find that even it is not automatic enough, take a look at a tool called autoconf

The make tool can do far, far more than we have space to discuss here. To find out more about make and what it can do for you, visit the GNU Make Manual

Remember: when you're assigning struct variables, you are telling the computer to copy data.

If you use the typedef command, you can normally skip giving the struct a proper name. But in a recursive structure, you need to include a pointer to the same type. C syntax won't let you use the typedef alias, so you need to give the struct a proper name. That's why the struct here is called struct island.

The nm command lists the names that are stored inside the archive.
nm /usr/lib/libruby1.8-static.a

When you bind a socket to a port, the operating system will prevent anything else from rebinding to it for the next 30 seconds or so, and that includes the program that bound the port in the first place. Use reuse option (p. 477)

MUT-EX = MUTually EXclusive.

The make tool knows quite a lot about C compilation, and it can use implicit rules to build files without you telling it exactly how.  For example, if you have a file called fred.c, you can compile it without a makefile by typing:
> make fred
cc fred.c -o fred

Purchase at Amazon