C Programming Language

Datatypes

Tharuksi Gunasekara
2 min readApr 11, 2022

Hello friends, in this article, I am going to discuss about Datatypes in C Programming Language. A Datatype, as the name implies, specifies the type of data being utilized. We must indicate the type of data whenever we define a variable or use any data in a C language program so that the compiler knows what to expect. Broadly, data types can divided into five categories:

  • Basic

Example: character, integer, floating-point, double.

  • Derived

Example: Array, structure, union, etc.

  • Enumeration

Example: enums

  • Bool type

Example: true or false

  • void

Example: Empty value

C Primary Data types

There are five basic(primary or primitive) datatypes. They are

· Character

· Integer

· Floating-point

· Double

· Void

These data types can be specified using keywords.

Every data type has a size specified in bits/bytes, and a range of values that it may hold.

Size of different Datatypes

The size of various data types is determined by the compiler and processor used.

char-1 byte

int-2 bytes/4 bytes

float-4 bytes

double-8 bytes

void-0 byte

C Datatype Modifiers

In the C language, there are 4 datatype modifiers, that are used along with the basic data types to categorize them further.

· signed

· unsigned

· long

· short

Signed and unsigned are used to represent signed(+ and -) and unsigned(only +) values for any data type, as their names imply. And the range of values for any datatype is affected by long and short.

example: signed int, unsigned int, short int, long int, etc..

C Datatype Value Range

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Tharuksi Gunasekara
Tharuksi Gunasekara

Written by Tharuksi Gunasekara

I am an undergraduate of faculty of Information technology in university of Moratuwa

No responses yet

Write a response