Data Types in C Language | What is Data Types?

C Data Types

Data types specify how we enter data into our c programs and what type of data we can enter in it. C language has some predefined set of data types to handle various kinds of data that we use in our c program. C data types have different storage capacities and meaning.

Different type of data types in C Language.

  • Primary data types : These are fundamental data types in C namely integer(int), floating(float), charater(char) and void.
  • Derived data types : Derived data types are like arrays, functions, stuctures and pointers.
C Data Types | Tech-Mirror
C Data Types | Introduction to C Data Types | What is Data Type in C | Tech-Mirror

Now Elaborate Primary C Data Types, these are as follows:

Primary data types

There are five basic data types associated with variables:

  1. int – integer: a whole number.
  2. float – floating point value: ie a number with a fractional part.
  3. double – a double-precision floating point value.
  4. char – a single character.
  5. void – valueless special purpose type which we will examine closely in later sections.

Derived Data Types

  1. Function : A function type describes a function that returns a value of a specified type.
  2. Arrays : An array is a container for data which is of all the same type. The type can be a basic type or a derived type. A C array is defined by using the square brackets [ ].
  3. Pointers : The basic concept is that a pointer provides a mechanism for determining the address of data.
  4. Structure : A structure type is a sequentially allocated nonempty set of objects, called members.Union
  5. Union : A union type can store objects of different types at the same location in memory.

Important Points to remember in C Data Types :

  • Identify the type of a variable when it declared.
  • Identify the type of the return value of a function.
  • Identify the type of a parameter expected by a function.

Go to Next >> Basics of C Language

 

One comment

Leave a Reply

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