The C Language Revision - I

 

||     LOGIC FAMILIES     ||     C TUTORIAL I     ||     C TUTORIAL II     ||     RESUME     ||

 

After I was thorough with Assembly level programming I started programming in the C language. I ported some of my Assembly language projects into C. Below is a revision of C language, which, I studied from The C Programming Language, by Kernighan and Ritchie.

This is more of my brain dump which I would be using to refer back myself, and, has nothing to do with the original text or ideas of K&R. I am not selling this. And it may contain errors/bugs. You may treat it as a reference or a tutorial or whatever.


  • ANSI - American National Standards Institute. They formed a committee for standardizing C, making it ANSI C, in 1983. (3 years after my birth.)

  • Data types in C - char (1B), int (2B), float (4B), double (8B)
    Qualifiers - short (16b), long (32b), unsigned (all positive), signed (half negative)
    Depends on compiler.
    Contained in <limits.h> and <float.h>

  • L or l = Long/Double
    U or u = Unsigned
    F or f = Float
    Number starting with 0 = Octal
    Number starting with 0x = Hexadecimal

  • enum explanation {optionA, optionB, optionC};
    =>tells the compiler that optionA=0, optionB=1, optionC=2
    =>you may also assign specific values through enum

  • Automatic Variable - Local variables in a function. They need to be initialized.
    External and Static variables - Are initialized to 0 by default.

  • <ctype.h> contains tests and conversions like conversion to lower case and upper case.

  • "~" is the unary operator which gives 1's compliment of an Integer.

  • extern is used when a variable is defined in a different source file or it is referred to, before it has been defined.

  • static can be used in two ways:

    • If static is used for local variables, then that variable remains in existence, thus providing it with permanent storage.

    • If static is used for a extern variable, then that variable becomes invisible to all files except the one in which it is declared to be static extern. 

  • register declaration requests the compiler to keep that variable in one of the registers.

  • volatile declaration tells the compiler not to optimize that variable and fetch its value from the memory/device each and every time it is needed and asked for.

  • #define is the antonym of #undef

  • For Conditional Inclusions use: #if !defined(whatever) #elif #else #endif (#ifndef is also present)

 

>> Next page >>


[email protected]

Content Copyright (c) 1998-2003
 Jagmeet Singh Hanspal.
All Rights Reserved.

Hosted by www.Geocities.ws

1