MIKROC VARIABLE NAMES AND TYPES

on Monday, 23 September 2013
In this post we will look at the mikroC variable names and its types and its predefined memory.

VARIABLE NAMES:
Rules for the variable names in mikroC is similar to C language, check the points which are given below.

  • Variable names can begin with an alphabetical characters or with underscore character i.e it can be any characters a to z and A to Z, the digits 0 to 9, and underscore " _ " .
  • Each variable name should be unique with 31 characters at most.
  • Variable names can be mixed with upper and lower case characters.
  • Names which are reserved for the compiler cannot be used. 
One important different between normal C and MikroC is that MikroC is not case sensitive i.e upper and lower case characters are considered one and the same. Look at the names below all of them are considered as same.

Name                    nAme                        naMe                          namE


VARIABLE TYPES:
MikroC supports the variable types which are shown below , if you want to know more then just go to the 'help' section of your MikroC compiler.

Asm
do
if
static
auto
double
int
struct
break
else
long
switch
case
enum
register
typedef
char
extern
return
union
const
float
short
unsigned
continue
for
signed
void
default
goto
Size of
Volatile and while






 Let us see few important types which we are going to use frequently in our programming. 

Unsigned Char or Unsigned short int :
The range of the type is 0 to 255 i.e it is of 8 bits i.e the variables of this type cannot hold the value which is more than 8 bits i.e more than 255 .
Declaration is something like this shown below 

unsigned char variable_name  ; 
or
char variable_name;

Example: unsigned char xyz; 
xyz variable can hold upto 8bit length. 

Signed char or signed short int :
They are also 8 bits but they are signed character variable i.e range from -128 to +127. 

Signed char variable_name;
or
Short variable_name;
or
short int variable_name;

Example: signed char abc ; 
              or you can declare as " signed char abc=-20 ;" 

Signed int: 
It is of 16 bits i.e -32768 to +32767
int variable_name;

Unsigned int:
It is also of 16bit wide ranges from 0 to 65535.
Unsigned int variable_name;

Signed long int:
It is of 32bits ranges from -2147483648 to + 2147483647. 
Signed long variable_name; 

Unsigned long int:
It is also of 32 bits ranges from 0 to 4294967295.
Unsigned long variable_name;

Double or long double:
To represent the floating point numbers we use double or long double types they ranges from + or - 1.17549435082E-38 to + or - 6.80564774407E38.

From the above which i have mentioned "unsigned char, int" are used frequently in our programming.
AUTHOR: YOUSTRON SIC


1 comments:

Post a Comment