Categories
a. Basic Data Type

Understanding C Datatypes

As the name suggests, a Datatype defines the type of data being used. Whenever we define a variable or use any data in the C language program, we have to specify the type of the data, so that the compiler knows what type of data to expect.

For example, you may want to use a number like 12100, or a decimal point number like 99.9510.5, or a text, like “Studytonight”, all these values are handled differently by the C language compiler, hence, we use data types to define the type of data used in any program.

C Datatypes

Broadly, there are 5 different categories of data types in the C language, they are:

TypeExample
Basiccharacter, integer, floating-point, double.
DerivedArray, structure, union, etc.
Enumerationenums
Bool typetrue or false
voidEmpty value

C Primary Data types:

The C language has 5 basic (primary or primitive) data types, they are:

  1. Character – ASCII character set or generally a single alphabet like ‘a’‘B’, etc.
  2. Integer – Used to store whole numbers like 121001000, etc.
  3. Floating-point – Decimal point or real numbers values like 99.910.5, etc.
  4. Double – Very large numeric values which are not allowed in Integer or Floating point type.
  5. Void – This means no value. This data type is mostly used when we define functions.

There are different keywords to specify these data types, the keywords are:

DatatypeKeyword
Characterchar
Integerint
Floating-pointfloat
Doubledouble
Voidvoid

Leave a Reply

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