Identifiers:

All the words that we will use in c are keywords or identifiers. keywords are predefined and can’t be changed by the users, While identifiers are used to give names to entities likes variables, arrays, functions and etc.

There are some rules naming identifiers as:

  • The name should consist of only alphabets (upper case and lower case), digits and underscore sign ( _ ).
  • First character of identifier should be an alphabets or underscore.
  • Name should not be a keyword.
  • because c is case sensitive language, so upper case and lower case letter are considered different. for example code and CODE, Code, cOde, coDe, codE all are different.

Data Types:

There are four basic data types as: int, char, float, double. The size and range of different types on 16 bit machine as:

Data Types Data types with qualifier Size(Bytes) Range
char Signed char 1 byte -128 to 127
Unsigned char 1 byte 0 to 255
int Signed int 2 byte -32768 to 32767
Unsigned int 2 byte 0 to 65535
Signed short int 1 byte -128 to 127
Unsigned short int 1 byte 0 to 255
Signed long int 4 byte -2147483648 to 2147483647
Unsigned lon int 4 byte 0 to 4294967295
float float 4 byte 3.4E-38 to 3.4E+38
double double 8 byte 1.7E-308 to 1.7E+308
double Long double 10 byte 3.4E-4932 to 1.1E+4932

Constants:

Constant is a value that cannot be changed during execution of the program. there are three types of constants:

  • Numeric constants:- Numeric constants consist of numeric digits, they may or may not have decimal points ( . ).
    • integer constants : Integer constants are whole numbers which doesn’t consist decimal point( . ).
      • Decimal (0,1,2,3,4,5,6,7,8,9) (base 10)
      • Octal (0,1,2,3,4,5,6,7) (base 8)
      • Hexadecimal (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) (base 16)
    • real constants : real constants are also known as floating point constants. it contains decimal points.
  • Character constants : Character constants is a single character that is enclosed with single quotes ( ‘  ‘ ). Every character constant has a unique integer value associated with it.and that integer is the numeric value of character in the machine’s character code. ASCII values are as:

A to Z   ASCII values are ( 65 to 90 )

a to z    ASCII values are ( 97 to 122 )

0 to 9   ASCII values are ( 48 to 57 )

;  ASCII values are ( 59 )

  • String Constants : A string constant has zero, one or more than more characters. A string constant is enclosed within double quotes ( ” ” ).

Variables:

Variable is a name that can be used to  store values. Variables can store different values but one at a time and these values can be changed during execution of the program. A data type is associated with each variables.

Declaration of variables:

It is must to declare a variable before using it. Syntax for declaration of variables:

<data type> <variable name>;

Initialization of variable:

 when we declare a variable it contains undefined value also known as garbage value. If we want then we can assign some initial values to variable during declaration itself.

 for example: int a ; // declaration of variable

int b = 5 ; // initialization of variable

Expression :

An expression is a combination of operators, constants, variables and function calls. The expression can be arithmetic, logical or relational.

Statements :

A statement is executable part of a  program and gives instruction to computer to do some actions.

Leave a Reply

Your email address will not be published. Required fields are marked *