🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to C Notes
Topic #15

C Data Types


Data Types

As explained in the Variables chapter, a variable in C must be a specified data type, and you must use a format specifier inside the printf() function to display it:

Example

// Create variables
int myNum = 5;             // Integer (whole number)
float
myFloatNum = 5.99;   // Floating point number
char myLetter = 'D';       //
Character

// Print variables
printf("%d\n", myNum);
printf("%f\n", myFloatNum);
printf("%c\n", myLetter);

Basic Data Types

The data type specifies the size and type of information the variable will store.

In this tutorial, we will focus on the most basic ones:

Data Type Size Description Example
int 2 or 4 bytes Stores whole numbers, without decimals 1
float 4 bytes Stores fractional numbers, containing one or more decimals. Sufficient for storing 6-7 decimal digits 1.99
double 8 bytes Stores fractional numbers, containing one or more decimals. Sufficient for storing 15 decimal digits 1.99
char 1 byte Stores a single character/letter/number, or ASCII values 'A'

Basic Format Specifiers

There are different format specifiers for each data type. Here are some of them:

Format Specifier Data Type Try it
%d or %i int
%f or %F float
%lf double
%c char
%s Used for strings (text), which you will learn more about in a later chapter

Note: It is important that you use the correct format specifier for the specified data type. If not, the program may produce errors or even crash.

Want to go beyond the notes?

Join CodingNow 2.0's C course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

C Data Types – FAQs

Quick answers about learning C Data Types in C.

This free note from CodingNow 2.0 explains C Data Types in C — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every C topic on CodingNow 2.0, including C Data Types, is 100% free with no signup required.
With focused practice, most students grasp C Data Types in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now