Variable Types in C Programming Language

Posted by admin on January 25, 2010

Variable Types in C Programming Language

Variables are names which are declared in order to store a single value that can either be an integer or a character. It is must to declare the type of the variable also i.e int, char etc. Generally there are two types of variables namely :

  1. Global variables
  2. Local variables

These variables are classified on the basis of their place of declaration. WAIT! There is more to read… read on »

Derived Data Types in C Programming Language

Posted by admin on

Derived Data Types in C Language

Derived data types in C Programming Language are those C data types which are derived from the fundamental data types using some declaration operators.

Now, in this tutorial we will be discussing each of these derived data types in brief as we will again come across these topics in the next coming up sections.

1. Arrays:
Arrays can be defined as a set of finite and homogeneous data elements. Each element of an array is referenced using an index.

For example:
If we the name of an array is AR which have 5 elements then the array will be represented as :
AR[0], AR[1], AR[2], AR[3], AR[4]
Here, these subscripts which are containing the digit is known as an index. WAIT! There is more to read… read on »

C Language Operator Types: Operators in C

Posted by admin on

Kind of Operator Types in C Programming Language

Operators:

An operator can be defined as a thing which is used to represent the operations or specific tasks and the objects of the operations are referred to as operands.

There are various types of operators :

1)     Arithmetic operators

2)     Logical operators

3)     Relational operators

4)     Increment and decrement operators

5)     Conditional operators

6)     Bitwise operators

Now we will look at these operator types one by one. WAIT! There is more to read… read on »

C Programming Primary Constants: Integer, Real & Character

Posted by admin on

Integer, Real & Character: C Primary Constants

In the last article we gave an introduction about the kinds of Constants in C Language.

In this article we will discuss only about primary constants and secondary constants will be discussed in the later articles.

1) Integer Constants:

  1. It contains at least one digit.
  2. Fractions or decimals are not allowed. WAIT! There is more to read… read on »

Constants in C Programming Language: Primary & Secondary

Posted by admin on

Constants in C Programming Language

The keyword const can be added to the declaration of an object to make that object a constant rather than a variable.

The general syntax of constant declaration is :

Const data-type name = value;

Here const is known as a keyword that must be used to declare a constant.  Name is the name of the constant, data-type is the type of the data which we are declaring and value is the constant value of the data-type. WAIT! There is more to read… read on »

Storage Classes in C Programming Language: Auto, Register, Extern & Static Storage Types

Posted by admin on

Storage Types in C Programming Language

A storage class is used to tell the compiler how to store the variables and functions within a program or code. It is generally represented as :

Storage-class type variable-name ;

Different types of storage classes used in a C program are :

  1. Auto
  2. Register
  3. Extern
  4. Static WAIT! There is more to read… read on »

C Data Types: Range & Size

Posted by admin on December 29, 2009

We have already discussed the Data Types in C in the previous tutorial.

The following Chart will give you the range & sizes of all the data types in C Language along with their Type Modifiers.

Data Type

Range

Bytes

signed char -128 to + 127 1
unsigned char 0 to 255 1
short signed int -32768 to +32767 2
short unsigned int 0 to 65535 2
signed int -32768 to +32767 2
unsigned int 0 to 65535 2
long signed int -2147483648 to +2147483647 4
long signed int -2147483648 to +2147483647 4
long unsigned int 0 to 4294967295 4
float -3.4e38 to +3.4e38 4
double -1.7e308 to +1.7e308 8
long double -1.7e4932 to +1.7e4932 10

This Chart will help you in greater extent in finding the exact range & size of the data types in C Language.

Type Modifiers in C Language: signed, unsigned, long & short

Posted by admin on

Data Type Modifiers/Qualifiers in C Language

In the previous tutorial we discussed about the primary data types in C Language. In addition, these data types have some modifiers preceding them. The use of these modifiers changes the meaning of the base type.

The memory in the computer is organized in terms of units called bytes. One byte consists of 8 bits and bit is a smallest unit of memory.

Need of Data Modifiers:

Let us take an example of a Program where we need to input the “Salary” of “Employees”  in a team. This program will accept the salary as an input from user and then calculate the Income Tax of that user. We use “int” to store the Salary of the employee as we are assuming that the salary will be in “Whole Numbers”.

An integer data type takes 2 Bytes of Memory and we are aware that the Salary of any of the employee can not be “Negative”. We are using “2 Bytes” to store the memory of an Employee and we can easily save 1 Byte over there by removing the “Signed Part” in the integer. This positive value can easily be stored in “1 Bye Int” This leads us to the user of Data Type Modifiers. WAIT! There is more to read… read on »

C Language Fundamental Data Types: Int, Float, Char, Double

Posted by admin on December 27, 2009

Fundamental / Basic / Primary Data Types in C Language

The fundamental data types are of following types:

Integer(int) data type:

Integers are whole numbers. They have no fractional parts. These integers are represented using int data type. Integers can be positive or negative. The integer variable consumes 2 bytes of memory in the code.

Example:

#include
Void main()
{
int num;
num=17;
}

Character(char) data type: WAIT! There is more to read… read on »

C Language Data Types

Posted by admin on December 25, 2009

Data Types in C Language

Data can be of many types e.g., integer, fraction or real, character, string etc.

  • Numbers that does not have fraction part represents integer data.
  • Numbers with decimals or fraction represents real data.
  • Any data which is enclosed within single quotes represents character data.
  • Any data which is enclosed within double quotes represents a string.

Since the data is of many types, therefore C language provides many ways and options to handle all kind of data.

C Programming Language provides ways to handle different types of data by providing data types. WAIT! There is more to read… read on »

TopOfBlogs