Difference Between Fundamental Data Types and Derived Data Types

By Anjnee Bhatnagar|Updated : September 27th, 2022

In C programming, both the fundamental data types and derived data types are used frequently. However, there is a fundamental difference between fundamental data types and derived data types based on their usage and functionality. A data type in C programming specifies the type of data a user is intended to use.

Difference Between Fundamental Data Types and Derived Data Types PDF

In programming, there are broadly two types of data types, the fundamental data types and the derived data types. In this article, we will be focusing on the difference between fundamental data types and derived data types. After learning about the difference between fundamental data types and derived data types, we will briefly learn about each of the data type categories present in C.

Download Complete Digital Logic Formula Notes PDF

Difference Between Fundamental Data Types and Derived Data Types

Difference Between Fundamental Data Types and Derived Data Types

The difference between fundamental data types and derived data types is based on their usage and functionality. The fundamental data type or primitive data type refers to the set of values that a data item may take. The derived data types are defined by the user. The difference between fundamental data types and derived data types is presented in the table given below.

Fundamental Data Types vs Derived Data Types

Fundamental Data Types

Derived Data Types

They are referred to as primitive types or basic types.

They are referred to as aggregate types as they are formed by the aggregation of basic types.

Fundamental types are int, char, float, etc.

Derived types are array, structure, union, etc.

The integer type is classified as signed int, unsigned int, long int, and short int.

Pointers are used to store the address of variables.

Integers are used to store integer values in the range.

An array data type is used to store the homogenous data items.

The float type stores decimal numbers.

The structure uses primitive data types. It stores heterogeneous data.

What are Fundamental Data Types?

In C programming, the fundamental data type or primitive data type refers to the set of values that a data item may take. Every variable in C is associated with a data type. Each type requires some amount of memory and has operations associated with it.

In C, the fundamental data type is also called basic data type or primitive data type. Each basic data type has a range of valid values and sizes in bytes associated with them. These basic data types are divided into four types, as shown in the below table.

Data Type

Size of Bytes

Range

Use

char

1

–128 to 127

To store characters

int

2

–32768 to 32767

To store integer numbers

float

4

3.4E–38 to 3.4E+38

To store floating-point numbers

double

8

1.7E–308 to 1.7E+308

To store big floating-point numbers

What are Derived Data Types?

In C, the derived data types are defined by the user. This is the basic difference between fundamental data types and derived data types, as fundamental data types are predefined for the language and cannot be modified or redefined by the user or programmer. It is formed by combining one or more basic data types.

By using derived data types, we can develop a variety of new types from the basic types. The derived data types are available to provide convenience to the programmer in writing long source codes. Widely used derived data types in C programming are arrays and structures. Apart from array and structures, we have union and enumeration.

Key Difference Between Fundamental Data Types and Derived Data Types

The key difference between Fundamental Data Types and Derived Data Types are given below.

  • In fundamental data types, each data type requires different amounts of memory and has some specific operations which can be performed over it. In derived data types, data types are defined by the user itself. It comprises Class, Union, Arrays, Structures, Enumeration, Pointers, etc.
  • In fundamental data types, we utilize character for characters. It falls under the char, signed char, and unsigned char categories. However, in Derived Data Types, pointers are used to store variable addresses.
  • In fundamental data types, when a return value is not necessary, a void is utilized. A derived data type is similar to a structure, but with each Union member having access to the same memory location
Other Important GATE Topics
Difference Between Linear and Non-Linear Data StructuresDifference between Microprocessor and Microcontroller
Difference Between Hard Copy and Soft CopyDifference Between overloading and overriding
Difference Between High-Level and Low-Level Languages Difference Between drop and truncate

Comments

write a comment

FAQs on Difference Between Fundamental Data Types and Derived Data Types

  • The difference between fundamental data types and derived data types is that the fundamental data types are Primitive data types whereas, the combination of fundamental data types is a derived data type.

  • The difference between fundamental data types and derived data types based on the range of values is that a fundamental data type has an associated range of values that are valid along with the size in bytes that they occupy. On the other hand, derived data types have no predefined range or size for any data item.

  • An array is a linear arrangement of homogenous data items, and it is static in nature. That is, it requires the size of the array to be defined before the declaration. On the other hand, a structure is a collection of heterogeneous data items that is a structure can contain different basic data types simultaneously. The structures are also static in nature as they cannot grow dynamically in size.

  • A fundamental data type is declared just like any other predefined type following the syntax:

    data_type variable_name;

    While each derived data type has a different declaration, like an array follows the syntax:

    data_type array_name[size];

    The difference between fundamental data types and derived data types based on syntax varies from language to language. In C programming, the declaration is as shown above, while in other languages like C++, Java, etc., it is different.

  • In C programming, the data types are classified into two categories basic or fundamental types and derived types. The fundamental type is further divided into four:

    • Character
    • Integer
    • Float
    • Double
  • A data type specifies the range of values and size of memory it can allocate to a variable. A literal is a fixed value allocated to a variable. For example, int length= 78; In this, the data type used is integer indicated by int, and the literal is 78.

  • Data types that are defined in terms of other data types, or "base types," are referred to as derived data types. Derived types may include elements, mixed content, and attributes. They could be user-derived or built-in.

Follow us for latest updates