Primitive and Non Primitive Data Types in C: A Detailed Overview

Photo of author

Data types are fundamental in computer programming that describe data in a variable. Because C is a tightly typed language, each variable assigns a specific data type. Primitive and non-primitive data types are the two categories of data types in C.

Primitive data types are the fundamental building blocks of any programming language, and their types are integers, characters, floating point numbers, and boolean. Whereas, non-Primitive Data Types can be made of one or more than one primitive data types. The types of non-primitive data types are arrays and structures. 

primitive and non primitive data types in c-data types in java

Understanding the differences between these two data types can help programmers make better decisions when designing programs.

See Also: How To Choose The Interface Of A Website Properly? [Explained]

Primitive Data Types in C

The fundamental building blocks of any programming language are primitive data types. They regard it as “primitive” because they ingrain in the language and cannot further deconstruct it. The four main primitive data types in C are as follows:

Integers (int)

An integer is a complete number without any decimal places, which can be positive or negative. Depending on the system architecture, an integer in C can be any size; however, it usually ranges between 2 and 4 bytes.

primitive and non primitive data types in c-integers

Quantities, such as the number of goods in a shopping cart or the amount of a product in stock, can be represented using integers.

Floating-point numbers (float and double)

Decimal numbers are called floating-point numbers (float and double). The floating-point data types in C are float and double, and the float data type can store up to 6 significant digits, but the double data type may store up to 15 significant digits.


One mathematical operation that frequently uses floating-point values is calculating the average of a group of numbers.

Characters (char)

A character is a letter, number, or symbol, such as a punctuation mark. Char data type in C can represent any character from the ASCII character set and is typically 1 byte in size.

primitive and non primitive data types in c-character

In programming, characters are frequently used to describe text or symbols.

Boolean (bool)

A logical value, such as true or false, represents a boolean data type (bool). The bool data type is a relatively new addition to the C language.


It frequently implements as an integer value, with 0 indicating false and any matter other than zero representing true. Booleans commonly use programming to control code flow or make decisions based on logical conditions.

Non-Primitive Data Types

Unlike primitive data types, non-primitive data types do not build into the programming language itself; instead, they define the programmer and can be made up of one or more primitive data types. There are two main non-primitive data types in C: arrays and structures.


An array groups variables of the same data type. The data type and the number of members in a display can be specified when defining arrays in C.

primitive and non primitive data types in c-array

Int numbers, for instance, specifies a five-instance array of integers. It enables the definition of variables with the capacity to store numerous identical data items. The storage and manipulation of data sets, such as a list of names or a collection of test results, are complete in programming using arrays.


In C, a structure is a group of variables that creates user-defined data types. Specifically, a structure’s name and the data types of its constituent parts can define it. Furthermore, in programming, structures frequently represent complex data structures like customer records or points in three dimensions.


Imagine you wish to manage the books you have in a library. You may want to keep track of each book’s following characteristics –

  • Title
  • Author
  • Subject
  • Book ID

The declaration of the Book structure is as follows −

struct Books {

char title[50];

char author[50];

char subject[100];

int book_id;

} book;


What are primitive data types in C?

Primitive data types in C are the basic data types built into the language, such as integers, floating-point numbers, characters, and Boolean values.

What is an integer data type in C?

An integer data type in C stores whole numbers, both positive and negative, such as int, short, and long.

What is a floating-point data type in C?

A floating-point data type in C stores real numbers, such as float and double.

What is a character data type in C?

A character data type in C stores individual characters, such as char.

What are non-primitive data types in C?

Non-primitive data types in C are user-defined data types, such as arrays, structures, and pointers.

What is a pointer data type in C?

A pointer data type in C stores the memory address of another variable, allowing for dynamic memory allocation and manipulation of complex data structures.


In conclusion, fundamental ideas in C programming include primitive and non-primitive data types. Basic data types, which comprise integers, floating-point numbers, characters, and booleans, are the fundamental building blocks of the language. Nevertheless, non-primitive data types, such as arrays and structures, can compose of one or more primitive data types and defines the programmer. Programmers can create more effective and efficient code by understanding the differences between these two forms of data, which can help them make better judgments when designing systems.

See Also: Call back function in C

Leave a Comment