Types and Variables of C Programming
Data types needed to declare variables. Think about human, Human can be male or female or other gender. Male can’t take everything like female … right? 🙂 Data types is something like that. Each type can store a specific size of data.
Fundamental Data Type
- Integer Data Type, That.
- Floating Data Type.
- Character Data Type.
Derived Data Type
I will give an example only for Fundamental Data type and Derived on later post since it seems a bit advanced right now.
Variable just a name of an area where data will be saved. Whenever we need to use the data , we just need to call the specified name. The variable can contain letter,digits and underscore. And it must begin with letter or underscore. So we can declare a variable like this:
int age = 35; //This only can store integer
char name = 'Push Eax' //Only Char;
float _balance= 13.13f;
Data Type & Variable Example
char Char='P'; //Character
char name="push eax"; //String is a array of char
printf("%s\'s age is %d years old and has some false money.\n",name,age);
printf("%f is the amount of the false money.\n",_money);
printf("But %f needed for real %c.\n",Money,Char);
Compile the code:
gcc -o types -Wall -g types.c