In this article Data type in C we give the information about fundamental data type in C like int, char, float, double and void.

Data Type in C:

C language is huge & more in its data types.
There are three types of data types supported by ANSI C.
1. Primary data types.
2. Derived data types.
3. User-defined data types
All C compilers mostly support or handled five fundamental data types, namely integer (int), character (char), floating point (float), double-precision floating point (double) and void.

Data type in C

Data Type Keyword Bytes Required Range Format
Character(Signed) char 1 -128 to +128 %c
Integer(signed) int 2 -32768 to +32767 %d
Float(signed) float 4 -3.8e38 to +3.4e38 %f
Double double 8 -1.7e308 to +1.7e308 %lf
Long integer (signed) long 4 2,147,483,648 to 2,147,438,647 %ld
Character(unsigned) Unsigned char 1 0 to 255 %c
Integer (Unsigned) Unsigned int 2 0 to 65535 %u
Unsigned long integer Unsigned long 4 0 to 4,294,967,295 %iu
Long double Long double 10 -1.7e932 to +1.7e932 %Lf

Variable in C:-

Definition:- “A variable is a data name that may be used to store a data value.”

  • An important benefit of the variable is take different values at different times during execution.
  • A variable name can be select by the programmer in a meaningful way so the advantages of variable as to reflect its function or nature in the program.

Rules for Declaring Variables:-

  1. Variable names consist only letters, digits and the underscore(_) character.
  2. They must begin with a letter but some situation or systems permit underscore as the first character.
  3. Length should not be normally more than eight characters.
  4. Uppercase and lowercase are significant. that is, the variable Sum is not same as total or SUM
  5. It should not be a keyword.
  6. White space is not allowed.

Some examples of valid variable names are: Rajveer, rahul, neeta, n1, tot, Sum_num etc.

Invalid examples include: 123, % , char, 25th etc.

Declare Variable in C:

Syntax:

data_type variable_name;

Ex. int n1;

Initialize variable in C:

Syntax:

data_type variable_name= value;

Ex. int n1=10;

Some More: 

POP- Introduction to Programming Using ‘C’

DS – Data structure Using C

OOP – Object Oriented Programming 

Java Programming

DBMS – Database Management System

RDBMS – Relational Database Management System

Join Now: Data Warehousing and Data Mining 

Leave a Reply

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