Header Ads Widget

Built in Data Types in C

Built-in Data types are those data types that are pre-defined by the programming language. Most languages have native data types that are created for ease of execution of data. Such Data types are called Built-in Data Types. These data types can be used directly in the program without the hassle of creating them. Every programming language has its own specific set of built-in data types. We will learn about a few of them in this article below.

Definition

The term Built-in itself tells us that these categories of data types are defined by the programming language at prior. Built-in Data types are those data types that can be directly used by the programmer to declare and store different variables in a program.

They are also called Primary or Primitive Data Types. These Data types are believed to be one of the fastest modes to execute operations on Data. The syntax used for defining these data types is different for each programming language.

Real-Time Example of Built-in Data type

Suppose we want to create an automatic exam grading system for the students of a school. The data which we require will be Names, Roll numbers, Class, Division, Subjects, Marks, Grades. This data consists of various categories of data like Alphabets, Strings, Characters, Integers, Decimal Numbers, Symbols, etc. For this purpose, we can use the built-in data types which are provided by the programming languages. This data can be fed into the program by using the built-in data types such that the system finds it easy to accept, calculate, interpret and give results to the user.

Built-in Data Types

Different Built-in Data Types

Int, char, float, double, Boolean, void – are the most basic and common built-in data types in every programming language. Other than these if you want to work with complex data categories, you will have to define them yourself. Let’s look at these data types in depth-

1. Int 

This Built-in data type represents an integer number. It does not support any decimal or fractional number. Generally, Int has been allocated 4 bytes/32 bits of memory space. Integer numbers can contain Positive as well as Negative numbers.

Int Data Type is further divided into 2 type –

Signed Int – Allows positive as well as negative numbers.
Unsigned Int – Allows only positive numbers.

Ex:- 29, -50, 1947, 50384

2. Char

This data type accepts character values from the user. These characters include single letter, digit, symbol, special characters, etc. Char data type occupies 2 bytes/16 bits of memory space.

Ex:- ‘A’, ‘$’, ‘g’, ‘5’

3. Float

Float data type represents numbers that are in decimal format. They are commonly called floating-point numbers. Float takes up 4 bytes/32 bits of memory space.

Ex:- 25.56, 785.383, -3674.7358, -10

4. Boolean

This data type consists of only 2 values: True or False. It is a logical type of built-in data type. The default value of Boolean data type is False.

5. Double

It is a variant of the Floating-point data type which is also used to represent fractional and decimal numbers. Generally, 8 bytes/64 bits of memory space is allocated to it.

6. Void

This data type is widely used in C and C++ languages. It indicates that it has no value/empty. This data type is mainly used as a return type for functions that do not return a value to the caller function.

Post a Comment

0 Comments