Featured Posts

Writing Website Scrapers in PHPWriting Website Scrapers in PHP This article discusses about how to write a website scraper using PHP for web site data extraction. The concepts taught can be applied and programmed in Java, C#, etc. Basically any language that has a...

Readmore

12 common programming mistakes to avoid12 common programming mistakes to avoid Programming is an art and science and like all art and science the only way to learn is from mistakes. I have made many... and I would like to share with you the mistakes that I have made over my journey...

Readmore

7 habits of highly effective freelance programmers7 habits of highly effective freelance programmers I have developed these based on my freelancing experience. Though I have discontinued freelancing, but would like to share my practices with you. These are basic practices and have been developed over...

Readmore

  • Prev
  • Next

C Tutorial - Fundamental Data Types

Posted on : 22-05-2008 | By : admin | In : C Programming, C Tutorials

1

In this C Tutorial we will learn what Fundamental Data Types are and how to use them.

We develop programs to accept an input from the user and then run the input through a series of processes and produce the output on screen or on the printer, etc.

INPUT > PROCESS > OUTPUT

From the user’s point of view, the input supplied is data, which requires to be processed. Depending on the input provided by the user i.e. a number, fractional number, a name or an address, etc., the program must be designed to hold all these inputs. C provides the programmer with four basic or fundamental types of container to hold data, which are as follows:

Data Type Bytes Default Range
signed char 1 -128 to 127
Unsigned char 1 0 to 255
short signed int 2 -32768 to 32767
short unsigned int 2 0 to 65535
long signed int 4 -2147483648 to 2147483647
long unsigned int 4 0 to 4294967295
Float 4 -3.4e38 to +3.4e38
Double 8 -1.7e308 to +1.7e308
long double 10 -1.7e4932 to +1.7e4932




Following is the explanation of data types:

Character data type (char)

The character data type is only 1 Byte in size. It is used for only storing characters.

Integer Data type (int)

The integer data type is used to store whole numbers only. Fractional numbers are not allowed in an int data type.

Data type to store fractional numbers

float

The float data type is used to store floating point numbers or fractional numbers. This data type is 4 Bytes in size. Floating point numbers can also be expressed in the scientific notation e.g. 1.7e4 represents the number 1.7 x 104.

double

The double data type is also used to store floating point numbers or a fractional numbers. This data type is 8 Bytes in size. This data type can hold a large value.

This was about fundamental data types in c. In the subsequent C Tutorials we will learn how to use these data types by creating variables.

Subscribe now to receive updates when a new c tutorial is released.

Your email:

 




Comments (1)

once if u will send me fundamental of c languages.i will be greatfull for u for this.

Write a comment

Enter this code