3 top reasons for learning C:
- Good base for learning C++,C# or Java later.
- Unix,Linux,Windows,Gaming frameworks are written in C.
- C offers better interaction with H/W.
Constants = literals-> cannot change.
Variable=identifiers->May change.
Types of variables:
- Primary
- Secondary
Types of primary variables:
- Integer variables
- Real/float variables
- Character variables
Types of constants:
- Primary
- Secondary
Types of primary constants:
- Integer constants
- Real/float constant
- Character constants
Ranges:
- 2 byte integers: -32768 to +32767
- 4 bytes integers: -2147483648 to +2147483647
- float: -3.4*10^38 to +3.4*10^38
- In a char constant both quotes must slant to the left like ‘A’.
Variable has two meanings:
- It is an entity whose value can change
- It is a name given to a location in memory
- Variable names are case sensitive and must begin with an alphabet.
- Total keywords = 32 .e.g char,int,float etc.
- printf( ) is a function that can print multiple constants and variables.
- Formate specifiers in printf( ),scanf( ): int- %i, float- %f,char- %c.
- main( ) is a function that must always return an integer value: 0- if it meets success, 1 – if it encounters failure.
- Use /*………*/ for a comment in a program.
- & is ‘address of’ operator and must be used before a variable in scanf( ).
Source: “Let Us C’ by Yashavant Kanetkar