C Programming Data Types

int – Integer data types

Integers are whole numbers that can have both positive and negative values but no decimal values. Example: 0, -5, 10

In C programming, keyword int is used for declaring integer variable. For example:

int id;

Here, id is a variable of type integer.

You can declare multiple variable at once in C programming. For example:

int id, age;

float – Floating types

Floating type variables can hold real numbers such as: 2.34, -9.382, 5.0 etc. You can declare a floating point variable in C by using either float or double keyword. For example:

float accountBalance;

double bookPrice;

Here, both accountBalance and bookPrice are floating type variables.

In C, floating values can be represented in exponential form as well. For example:

float normalizationFactor = 22.442e2;

Difference between float and double

The size of float (single precision float data type) is 4 bytes. And the size of double (double precision float data type) is 8 bytes. Floating point variables has a precision of 6 digits whereas the precision of double is 14 digits.

 

char – Character types

Keyword char is used for declaring character type variables. For example:

char test = ‘h’;

Here, test is a character variable. The value of test is ‘h’.

The size of character variable is 1 byte.

Storage size and value rang of data types 

48,923 thoughts on “C Programming Data Types

  1. I have been surfing on-line more than three hours as of late,
    but I by no means found any fascinating article like yours.
    It’s lovely value enough for me. Personally, if all
    site owners and bloggers made just right content material as you probably did, the net shall be a lot more
    helpful than ever before.

  2. I just could not go away your website prior to suggesting that I extremely enjoyed the usual info a person provide for your guests?
    Is gonna be again steadily to check up on new posts

  3. I have noticed that charges for on-line degree pros tend to be a fantastic value. For instance a full Bachelors Degree in Communication with the University of Phoenix Online consists of 60 credits with $515/credit or $30,900. Also American Intercontinental University Online comes with a Bachelors of Business Administration with a whole education course feature of 180 units and a worth of $30,560. Online studying has made having your certification far more easy because you could earn your current degree through the comfort of your dwelling place and when you finish from office. Thanks for all other tips I have really learned through your blog.

  4. You actually make it appear so easy along with your presentation but I
    to find this topic to be actually something that I feel I might by no means understand.
    It kind of feels too complex and very extensive for me.
    I’m having a look forward to your subsequent put up, I will attempt to get the grasp of it!

  5. You could definitely see your enthusiasm in the work you write.
    The sector hopes for even more passionate writers such
    as you who are not afraid to mention how they believe.
    At all times go after your heart.

  6. Have you ever thought about publishing an ebook or guest
    authoring on other websites? I have a blog based upon on the same topics you
    discuss and would love to have you share some stories/information. I know my
    audience would value your work. If you are
    even remotely interested, feel free to send me an e mail.

Leave a Reply

Your email address will not be published.