# Constants in c

## 1)Integer constant#

An integer constant is a constant part without fractional parts.there are three subtypes of integer constants

1)Decmial integers 2)octal integers 3)hexadecimal integers

## 1)Decmial integers#

this consists of numbers of from 0 to 9 ,preceeded by + or – sign

valid examples:

const int x = 123;
const int x = -14323;
const int x = +1243;

invalid examples:

const int x = 12,3; //invalid character *
const int x = -143.23; //decimal
const int x = 12 4 3; //spaces
const int x = 066; //first digit cannot be zero

in the above wrong examples int x =143.23 can be exectuted ,but it prints only digits before decimal point .and int x=066 prints its ASCII number 54

## 2)octal integers#

octal integers can consists of any numbers from 0 to 7.the first digit must start with zero

valid examples: 034,0243,-0234423
invalid examples: 45432,5445

hexadeciml starts with 0x or 0X and we can include 0-9 numbers and a-z

valid examples: 0xA4B , 0x5FD243
invalid examples:
fxq4 //should be started with 0x
0x34i //only a-z are allowed
0x23.4b //decimals are not allowed

## 2)Real constants#

real numbers consists of digits 0-9 with a decimal point

exponents are also allowed .exponent should be an integer with optionl sign + or – .spaces are not allowed

valid examples: 023e2 , 13e-6 ,4.67E3,-2E45

## 3)character constants#

characters constants are single characters enclosed in pair of single quotes

valid examples :'A','o','4'

alphabets are stored as integers in c,for example A=65 ,a=97

## 4)string constants#

A string is a sequence of chars placed inside the double quotes.

valid examples :"codeskulls" , "ilovecode" ,"clan123"