Data Types in C with Examples -

The four basic data types in C language are defined as follows

  • Char:- It refers to the character. It can hold one letter and symbol. In fact, the character in c is associated with integers to refer to a letter/symbol as per ASCII( American Standard Code for Information Interchange) that has assigned integer value for all letters/symbols used in programming.
  • int:- This refers to an integer value. This is used to represent the signed or unsigned whole number within a specific range.
  • float:- This refers to a floating-point or real number. It is used to represent a real number like 3.174813 or 4.52e6 with six decimal digits in decimal or exponential form.
  • double:- This also refers to floating-point or real number. It can hold a real number in double precision. A double-precision number is used to represent 12 decimal digits like 3.412587632156 or 4.52145342148e12.
#include <stdio.h> 
int main()
{
// Create variables
int integerNumber = 10; // Integer number
float floatingNumber = 10.99; // Floating point number
char cahracterNumber = 'E'; // Character
// Print variables
printf("%d\n", integerNumber );
printf("%f\n", floatingNumber );
printf("%c\n", cahracterNumber );
return 0; }

--

--

Hi, This is Biplab and I am web developer well versed in PHP and other open source technologies. I am here to share my experience with the community.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Bipsmedium

Bipsmedium

Hi, This is Biplab and I am web developer well versed in PHP and other open source technologies. I am here to share my experience with the community.