Type of C Contants
C Contants are of following Types:-
Primary Constant :
Rules of Constructing Integer and Float Constant:-
Note :
  
Primary Constant :
- Integer
- Float
- Character
Secondary Constant :
- Array
- Pointer
- Structure
- Union
- Enum
Rules of Constructing Integer and Float Constant:-
| Sr.No | Rule | Integer | Float | 
| 1 | Decimal Point | Not Allowed | Allowed | 
| 2 | Sign | Positive or Negative | Positive or Negative | 
| 3 | Default Sign | Positive | Positive | 
| 4 | No of Digits | At least 1 | At least 1 | 
| 5 | Min Value | -32768 | -3.4e38 | 
| 6 | Max Value | +32767 | 3.4e38 | 
Format of Real Number Constant :-
Syntax :                                 mantissa e exponent                   
| Part | Type | Sign | 
| Mantissa | Integer Part of Real Number | Has Optional +/- Sign | 
| Exponent | Power of 10 | Has Optional +/- Sign | 
Note :
- Exponent Part Should be Always Integer.
- Default Sign is Positive for both Mantissa as well as Exponent
- Special Characters not allowed
- Spaces are not allowed
| Real Number | Representation | 
|---|---|
| 4567.45 | 4.56745e3 | 
| 0.00045 | 4.5e-4 | 
Consider Example 2 :
- Mantissa Should be in between 1 to 9
- Number : 0.00045 so shift decimal Point to Right by 4 Digit to obtain Mantissa as 4.5
- Decimal Point is Shifted 4 times to Right
- According to above Fig . Real Number : 4.5 e -4
Type of C Contants
![Type of C Contants]() Reviewed by ANAND PANDEY
        on 
        
7:57:00 AM
 
        Rating:
 
        Reviewed by ANAND PANDEY
        on 
        
7:57:00 AM
 
        Rating: 
      

No comments: