C-Data Types and Variable Naming

Data Types

C supports several different types of data, each of which may be represented differently within the 
memory.

Some of the data types used in C language are,

  •    int
  •    char
  •    short
  •    double 
  •    float


Variable Naming

Only underscores, letters and digits are allowed in variables. 

No special characters allowed other than underscore.

First character should be a letter or a underscore.

you can't have reserved words as the variable name.

           ex: int , char , continue

But you can have reserved words as variable name by capitalizing one or more letters in the word.

           ex: iNt, conTinue

Variable names are case sensitive.

And there are constants


A constant is a value or an identifier whose value cannot be altered in a program.



           ex: 1, 2.5, "C programming is easy", etc.

Those values cannot be changed.

const double PI = 3.14

Here, PI is a constant. Basically what it means is that, PI and 3.14 is same for this program.


  

Comments

Popular posts from this blog

Programming with Java

C- Control Structures

C - Functions