Constant Data and Variable Data / Data-Types

Types of data:

  1. Character data type: ‘a’, ‘z’, ‘1’ , ‘0’, ‘@’
  2. Integer data type: 123(decimal), 0x123(Hexadecimal), 0123(octal)
  3. Real data type :

a. Float data type: 23.5f , 0.25f

b. Double data type: 23.5 , 0.25

4. String data type: “abc” , “123” , “23.5”

Note : Whatever you write in ” ” compiler will be considered as string.

The syntax of declaring data type:

data_type variable_name;

Variable name should be, a- z, A- Z, 0 – 9 & underscore ( _ ).

In the name of variable, first character shouldn’t be a digit.

Example: int i;     (Right)

int 1i;   (wrong)

int i1;   (Right)

 

 

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Powered by WordPress.com.

Up ↑

%d bloggers like this: