Data Type In C
| Data Type | Size (Bytes) | Range | Format String |
|---|---|---|---|
| Char | 1 | -128 to 127 | %c |
| Unsignes Char | 1 | 0 to 255 | %c |
| Short Or Int | 2 | -32768 to 32767 | %i or %d |
| Unsigned Int | 2 | 0 to 65535 | %u |
| Long | 4 | -2147483648 to 2147483647 | %ld |
| Unsignes Long | 4 | 0 to 4294967295 | %lu |
| Flot | 4 | 3.4e-38 to 3.4e+38 | %f or %g |
| Double | 8 | 1.7e-308 to 1.7e+308 | %lf |
| Long Double | 10 | 3.4e-4932 to 1.1e+4932 | %lf |
Integar Data Type
| Short Integar | Long Integar |
|---|---|
| Occupies 2 bytes in Memory | Occupies 4 bytes in Memory |
| Range -32768 to 32767 | -2147483648 to 2147483647 |
| Format string is %d or % i | Format string is %ld |
| For example: int a=2; Short int b=2; | For example: long b; Long int c; |
Starting With C Program
all c program will code into the main() function make sure you have an compiler to complie your program
Simple example of c program
#include < stdio.h >
void main()
{
Printf("this is the most simple example of c program");
}
Click Here to get all the c programes.
Creating variables in c
Its very simple to create one or more variable in c, There are some basic datatypes which are used to create a simplea variable in c, Now question arries what is datatype datatypes is the identity of the variable. Its tell to compiler that which kind of data that Variable can store.
Now here ia an simple example to create an folder in c
int id = 1 , Now int is the integar datatye which only stores the integar values
Another example is string name="Hardeep Singh"
Print Variables in c
We can print the variable values in c this is very simpe task printf function is used to display the values in c so with the help of printf we can also print the variable here is an simple example of printing the variable in c
#include< stdio.h >
Void main()
{
string name = "hardeep Singh";
printf("%d",name);
}
Constant and Volatile Variables
•Constant variable-tells the compiler that the variable is constant
For example: const int m=10;
•Volatile variable-those variables that are changed at any time
For example: volatile int m;


