Keywords are reserved words which are found in Data Types,Control Statements and Function names.
All keywords are in Lower case. So Upper case can be used as variable names (i.e. Identifiers)
For more details visit:- http://tigcc.ticalc.org/doc/
2. Rules for forming variable names (i.e. Identifiers) in C
- It allows all Capital & Small letters and all Digits including underscore (_).
- Special characters (symbols) not allowed except underscore (_).
- Any variable name should start with a letter or underscore (_). (i.e. special symbols and digits not allowed in the beginning of variable name)
- Variable names are case sensitive that means Capital letters name and Small letters name are not considered same.
- Variable names cannot be keywords.
- Space is not allowed inside a variable name.
3. Data Types for Storage memory space
To store data we need to know which type of data elements are needed. Different type of data needs different data type. Each data type has its own range of values that it can store.
|DATA TYPE||TYPE OF DATA||MEMORY SIZE||RANGE OF VALUES|
|Int||Integer||2 Bytes||-32768 to +32767|
|Char||Character||1 Bytes||0 to 255|
|Float||Floating point number||4 Bytes||3.4 e -38 to 3.4 e -38|
|Double||Floating point number with double capacity||8 Bytes||1.7 e -308 to 1.7 e -308|
Lets know why do int store only numbers ranging from -32768 to +32767.
2 Bytes = 16 bits (Since 1 Byte = 8 bits)
In memory all we store is 0’s and 1’s
1 bit can store either 0 or 1. So one bit can store two values of binary number concept.
This is equivalent to 21=2 values.
2 bits can store either 00 or 01 or 10 or 11 there equivalent value in decimal is 0 or 1 or 2 or 3.
This is equivalent to 22=4. And so on 3 bits will have 23=8 values.
3 bits can store either 000 or 001 or 010 or 011 or 100 or 101 or 110 or 111 there equivalent value in decimal is 0 or 1 or 2 or 3 or 4 or 5 or 6 or 7.
2 Bytes will have 16 bits that means 16 bits will have 216=65536 values. First bit is used to save sign (i.e. + or -) represented by zero for minus sign and one for plus sign. So 16-1=15 bits and 215=32768 values. But integers are of positive as well as negative numbers. So the range is divided on positive and negative scale. So the number range should be -32768 to +32768.
Scale: Negative -|——————–|0——
But if we include positive and negative numbers equally than what about Zero (0). Since zero is coming under positive scale the range is -32768 to +32767.
Lets know why do char range is from 0 to 255.
1 Byte will have 8 bits that means 8 bits will have 28=256 values. But here also the range is from 0 to 255. Since zero is also included. Known you will have doubt that how a number ranging from 0 to 255 can represent characters. To represent characters there is a character chart which is also called ASCII chart or ASCII code or ASCII table. In this each character is assigned a value from 0 to 255 including Beep (sound) inside the ASCII chart. So when we enter any character in the computer the equivalent number assigned to that character is saved in the binary form. Since computer understands only binary language. (i.e. 0’s and 1’s)
For float and double see à Single precision and Double precision.
4. Data Types Qualifiers
short, long, signed, unsigned are called Data type Qualifiers and can be used with any data type.
|DATA TYPE||MEMORY SIZE||RANGE OF VALUES|
|short int or int||2 Bytes||-32768 to +32767|
|long int||4 Bytes||-2147483648 to +2147483647|
|signed int||2 Bytes||-32768 to +32767|
|unsigned int||2 Bytes||0 to 65535|
short and signed int are same as int because int is by default short and signed. Mostly used qualifiers are long and unsigned.
long qualifier is used to double the bytes of memory size. And the range expands from 216-1 to 232-1 values (i.e. 215 to 231) one bit for sign (+/-).
unsigned qualifier is used to use same bytes of memory size. And the range shifts from negative to positive side. One bit for sign (+/-) is released. So now all 16 bits will be used for values (i.e. 216 = 65536 and range will be 0 to 65535).
5. Different Types of Operators
Arithmetic operators are used for making mathematical expression and evaluating results in any kind of formulas by using Brackets wherever needed.
|==||X==Y||X is equal to Y|
|!=||X!=Y||X is not equal to Y|
|<||X<Y||X is less than Y|
|<=||X<=Y||X is less than or equal to Y|
|>||X>Y||X is greater than Y|
|>=||X>=Y||X is greater than or equal to Y|
Relational operators are used to check any condition by comparing the values of variables used inside a program. The result of any comparison (condition) will give you true or false only.
Logical operators (AND and OR) combine two conditions and logical NOT is used to negate the condition i.e. if the condition is true, NOT negates it to false and vice versa.
video: this video is about how to install turbo c compiler which is used to create and execute the C program.
Note:- To understand program for sequence in detail Please SEARCH numerically example: C001, C002, etc.