Monday, August 31, 2009

The ANSI C Programming Language

I have been reading the book 'The ANSI C Programming Language' from 'Brian W.Kernighan & Dennis M.Ritchie'. It is very excellent. I would recommend it once you get some hands in to C language. It does not beat around the bush. A MUST READ FOR A C PROGRAMMER.

Some interesting notes are -
1. '\n' represents only a single character. An escape sequence is used for hard to type or invisible characters.
2. The range of both int and float are dependent on the machine .
3. printf is not part of the C language, it is just a useful function from the standard library of
functions that are normally accessible to C programs and its behaviour is defined by ANSI
std.
4. EOF is an integer defined in
5. An isolated semicolon statement is called as Null Statement
6. A character represented within a single quotes gives numerical value. Ex - '\n' is equal to 10.
7. getchar returns ascii value of character being read.
8.when a string constant like"hello\n"appears in a C program, it is stored as an array of characters containing the characters in the string and terminated with a '\0' to mark the end.
The %s format specification in printf expects the corresponding argument to be a string represented in the above form.
9.An external variable must be defined, exactly once, outside of any function; this sets aside storage for it. The variable must also be declared in each function that wants to access it; this states the type of the variable. The declaration may be an explicit extern statement or may be implicit from context.
10. ''Definition'' refers to the place where the variable is created or assigned storage.
``Declaration'' refers to places where the nature of the variable is stated but no storage is allocated.

No comments:

Post a Comment