Data species in c express to comprehensive system used for declaring variables or attributes of different types. The kind of a variable determines how much an are it occupies in storage and how the bit pattern save is interpreted.

You are watching: How many bytes in a float

The species in C have the right to be divide as adheres to −

Sr.No.Types & Description

Basic Types

They room arithmetic species and are additional classified into: (a) integer varieties and (b) floating-point types.


Enumerated types

They are again arithmetic types and castle are used to define variables that can only assign certain discrete integer values throughout the program.


The kind void

The form specifier void shows that no value is available.


Derived types

They incorporate (a) tip types, (b) selection types, (c) framework types, (d) Union types and (e) function types.

The array types and structure species are referred jointly as the accumulation types. The kind of a role specifies the form of the function"s return value. We will check out the straightforward types in the adhering to section, where as other species will be extended in the upcoming chapters.

See more: How To Remove Drawers With Metal Glides And No Levers, 4 Ways To Remove Drawers

Integer Types

The complying with table offers the details of traditional integer species with your storage sizes and value ranges −

To obtain the exact size that a kind or a change on a certain platform, you deserve to use the sizeof operator. The expression sizeof(type) yields the storage dimension of the thing or kind in bytes. Given listed below is an instance to acquire the dimension of various form on a machine using different consistent defined in limits.h header paper −

Live Demo

#include #include #include #include int main(int argc, char** argv) printf("CHAR_BIT : %d\n", CHAR_BIT); printf("CHAR_MAX : %d\n", CHAR_MAX); printf("CHAR_MIN : %d\n", CHAR_MIN); printf("INT_MAX : %d\n", INT_MAX); printf("INT_MIN : %d\n", INT_MIN); printf("LONG_MAX : %ld\n", (long) LONG_MAX); printf("LONG_MIN : %ld\n", (long) LONG_MIN); printf("SCHAR_MAX : %d\n", SCHAR_MAX); printf("SCHAR_MIN : %d\n", SCHAR_MIN); printf("SHRT_MAX : %d\n", SHRT_MAX); printf("SHRT_MIN : %d\n", SHRT_MIN); printf("UCHAR_MAX : %d\n", UCHAR_MAX); printf("UINT_MAX : %u\n", (unsigned int) UINT_MAX); printf("ULONG_MAX : %lu\n", (unsigned long) ULONG_MAX); printf("USHRT_MAX : %d\n", (unsigned short) USHRT_MAX); return 0;When you compile and execute the above program, it produces the following an outcome on Linux −

Floating-Point Types

The adhering to table provide the details of standard floating-point varieties with warehouse sizes and also value ranges and their precision −

TypeStorage sizeValue rangePrecision
float4 byte1.2E-38 come 3.4E+386 decimal places
double8 byte2.3E-308 come 1.7E+30815 decimal places
long double10 byte3.4E-4932 to 1.1E+493219 decimal places

The header paper float.h specifies macros that allow you to use these values and also other details about the binary representation of real numbers in her programs. The following instance prints the storage room taken through a float type and its variety values −

Live Demo

#include #include #include #include int main(int argc, char** argv) printf("Storage size for to rise : %d \n", sizeof(float)); printf("FLT_MAX : %g\n", (float) FLT_MAX); printf("FLT_MIN : %g\n", (float) FLT_MIN); printf("-FLT_MAX : %g\n", (float) -FLT_MAX); printf("-FLT_MIN : %g\n", (float) -FLT_MIN); printf("DBL_MAX : %g\n", (double) DBL_MAX); printf("DBL_MIN : %g\n", (double) DBL_MIN); printf("-DBL_MAX : %g\n", (double) -DBL_MAX); printf("Precision value: %d\n", FLT_DIG ); return 0;When girlfriend compile and execute the over program, it produces the following result on Linux −

Storage size for to rise : 4 FLT_MAX : 3.40282e+38FLT_MIN : 1.17549e-38-FLT_MAX : -3.40282e+38-FLT_MIN : -1.17549e-38DBL_MAX : 1.79769e+308DBL_MIN : 2.22507e-308-DBL_MAX : -1.79769e+308Precision value: 6

The void Type

The void type specifies that no value is available. That is used in 3 kinds of situations −

Sr.No.Types & Description

Function returns as void

There are various attributes in C which execute not return any type of value or you can say they return void. A role with no return value has actually the return form as void. Because that example, void leave (int status);


Function debates as void

There room various features in C which execute not accept any kind of parameter. A function with no parameter have the right to accept a void. For example, int rand(void);


Pointers to void

A pointer of kind void * to represent the deal with of one object, however not that is type. Because that example, a memory allocation function void *malloc( size_t size ); return a reminder to void which can be casted to any type of data type.