ProAnswers.org

Primitive and non primitive data structure in c programming?

1 Like

Primitive types are the data types provided by a programming language as basic building blocks. Primitive types are also known as built-in types or basic types.

Depending on the language and its implementation, primitive types may or may not have a one-to-one correspondence with objects in the computer’s memory. However, one usually expects operations on primitive types to be the fastest language constructs there are. Integer addition, for example, can be performed as a single machine instruction

Data type specifies the type of data stored in a variable. The data type can be classified into two types Primitive data type and Non-Primitive data type

PRIMITIVE DATATYPE

The primitive data types are the basic data types that are available in most of the programming languages. The primitive data types are used to represent single values.

Integer: This is used to represent a number without decimal point.
Eg: 12, 90

Float and Double: This is used to represent a number with decimal point.
Eg: 45.1, 67.3

Character : This is used to represent single character
Eg: ‘C’, ‘a’

String: This is used to represent group of characters.
Eg: “M.S.P.V.L Polytechnic College”

Boolean: This is used represent logical values either true or false.

NON-PRIMITIVE DATATYPES
The data types that are derived from primary data types are known as non-Primitive data types. These datatypes are used to store group of values.

The non-primitive data types are

  • Arrays
  • Structure
  • Union
  • linked list
  • Stacks
  • Queue etc