Find Range of Data types in C - C Programming Tutorial 11

preview_player
Показать описание
Notes for You:: Find Range of Data types in C - C Programming Tutorial 11
- The data type also indicates the possible range of values can be stored in a specific type of a variable or a constant.
1. int: 4 or 2 bytes : (-32,768 to 32,767 ) or (-2,147,483,648 to 2,147,483,647).
2. float : 4 bytes : 1.2E-38 to 3.4E+38.
3. double: 8 bytes : 2.3E-308 to 1.7E+308.
4. char: 1 byte : -128 to 127.
5. void: 1 or 0 byte : no value or nothing.

Note:
1 byte = 8 bits, 2 bytes = 16 bits, 4 bytes = 32 bits, 8 bytes = 64 bits.

Example Code:
#include <stdio.h>
#include<limits.h>
#include<float.h>
int main()
{
printf("int min=%i\n",INT_MIN);// =-2147483648
printf("int max=%i\n",INT_MAX);// 2147483647

printf("float min=%e\n",FLT_MIN);// 1.175494e-038
printf("float max=%e\n",FLT_MAX);// 3.402823e+038

printf("double min=%e\n",DBL_MIN);// 2.225074e-308
printf("double max=%e\n",DBL_MAX);// 1.797693e+308

printf("char min=%i\n",CHAR_MIN);// -128
printf("char max=%i\n",CHAR_MAX);//127

printf("float precision=%i\n",FLT_DIG);//6
printf("double precision=%i\n",DBL_DIG);//15
printf("long double precision=%i\n",LDBL_DIG);//18
return 0;
}

Note:
- replace < with less-than symbol.
- replace > with greater-than symbol.

=========================================

In the next C programming tutorial you understand; What are Data type Modifiers in C programming language. You understand the short, long, signed and unsigned Data type Modifiers in C language.

In the previous C programming tutorial you understand; C Program to find the Size of int, float, double, char Data types in C language, What is the use of sizeof() function in C language, etc.

=========================================

C Programming Tutorials Playlist:

=========================================
Watch My Other Useful Tutorials:-

Computer Programming Fundamentals Playlist:-

C Practical LAB Exercises Playlist:-

C++ Tutorials Playlist:

=========================================

► Subscribe to our YouTube channel:

► Visit our Website:

=========================================
Hash Tags:-
#ChidresTechTutorials #CProgramming #CProgrammingTutorial
Рекомендации по теме
Комментарии
Автор

👍Every video on my channel is made with Love and Hard work, So don't forget to Like, Comment & Share.
👉Please do Subscribe, Hit the bell icon & Enjoy Learning. It's FREE.

ChidresTechTutorials
Автор

Dear sir, you didnt specify any header for the char data type when finding the range. is the #include<float.h> header file used for finding the range of char? I mean which header file enables the execution of finding the range of "char"

danielokebugwu
Автор

Hello Chidre'sTechTutorials
Why the negative value/range of integers is -128 while the value/range of positive integer is 127?
And please tell also what do you mean by signed and unsigned value?
Does signed value mean -5?
Does unsigned value mean 5?

EduSadiq
Автор

what is format specifier for long double
and also give one example for find the min & max value

bhargavrajreddy
Автор

dear sir, what does W.K.T mean: It is written just above the bits area in the note you displayed

danielokebugwu
Автор

can you show how to calculate mathematically without using any header file? In C

soumeshkhuntia
Автор

Sir i have doubt int 4byts and also float be 4byts but range not same why
So. Please calculate and explain sir float range float range also 4byts 32bits also int 4byts also 32bits but range come to different why sir????

srikanthchithari
Автор

Sie i Ane naki kayi rete karvy aa kevu

kuldip_kanzariya
Автор

if %e result is
long double min
long double max :-1.#QNAN0e+000

bhargavrajreddy
Автор

%Lf and % lf using these the result is
long double min :
long double max : -1.#QNAN0

bhargavrajreddy