NEW USER

Reply

New Forum

Variables are made by programmers.It can be modified.When we defined any data object as a singular variable can be defined also as an array.
In C variable are of many type. Like: an integer or character, or may be of compound data objects(Like: structure or unions).
Initialization of variable:
int num; //Here we declare num variable as integer and it is initialized as default size.
int num=0; //Here we declare num variable and initialize them with 0.

Some useful difference b/n definition and declaration are given below:
When define an object not only its attribute are made known,but its object are also created.Where as when we declare an object only its attribute are made known.
Example:
We define object like;
long int lSum;
long int lCount;
void SumInt(int nItem)
{
lSum =lSum + (long)nItem;
++lCount;
}
We declare an object like;
void VFunction(int nType)
{
int nTest;
nTest = nType;
}

Some data types are to used to effect the characteristic of data object.These are called modifiers.Below i have shown you some modifiers:
Data type modifiers in C:
long: Forces a type int to be 4 bytes (32 bits) long and forces a type double to be larger than a double (but the actual size is implementation
defined).
short: Forces a type int to be 2 bytes (16 bits) long.
unsigned: Causes the compiler (and CPU) to treat the number as containing only positive values. Because a 16-bit signed integer can hold values between �32,768 and 32,767, an unsigned integer
can hold values between 0 and 65,535. The unsigned modifier can be used with char, long, and short (integer) types.

C Language has supported many data types.Which we use writing program.C Language gave authority to programmers to create and use datatypes.
Below i have shown you list of basic data types.That are introduce by ANSI standard.
datatypes in C:
char: required 1 byte and it used for characters or integer variables.
int: required 2 or 4 bytes and it used for integer values.
float: required 4 bytes and it used for Floating-point numbers.
double: required 8 bytes and it used for Floating-point numbers.

We can use fseek(),fread(),fwrite() and ftell() functions like that,
fseek(f,1,item)->Move the pointer for file f a distance 1 byte from location item.
fread(s,item1,item2,f)->Enter item2 data items,each of size item1 bytes,from file f to string s.
fwrite(s,item1,item2,f)->send item2 data items,each of size item1 bytes from string s to file f.
ftell(f)->Return the current pointer position within file f.
Functions fread,fseek and fwrite returned type is int and ftell is long int.

using keyword register we can use the process register in C.Basically process register is used to store variables those i want to access frequently.if these registers are not used in any other program,then those registers we used to
allocate memory these variables.