Now back to some theory , from the previous programs we used something called an int where we declared variables and used a placeholder %d in the printf statements
Now let us look at in in detail . C is a strongly typed language meaning it is strict and when we declare a variable we need to tell C what kind of variable it is (what value will it hold ).
This is known as the Data Type . Here are a few inbuilt data types in C with some information about them
Now let us look at in in detail . C is a strongly typed language meaning it is strict and when we declare a variable we need to tell C what kind of variable it is (what value will it hold ).
This is known as the Data Type . Here are a few inbuilt data types in C with some information about them
Name Type Storage Size Placeholder
- Integer int 2 or 4 bytes %d
- Decimal float 4 bytes %f
- Character char 1 byte %c
These are the data types . They can be modified using modifiers about which we will see in later posts
we will be commonly using char , int , float.
Please note that in this blog we are dealing with C programming from a practical point of view. We are not concerned with in depth knowledge of C but only about how to write your own
programs using the basics..
In the previous programs we used the int datatype . Which didn't give you correct results during the division operation as it rounded off the quotient . We will look at how we can use other datatypes in the coming posts .. Stay Tuned..................
No comments:
Post a Comment