e6390af40fd246928c9f6b67562cf0fa37712fa8

8/19/2017

What is the data type in c++ programming language

In this post we will discus some basic c programs that will help to learn to code c++ programming language.In c programming language there are five datatypes but we discus three data types like int, float, char. 
                                   " Data types is a type of variable to store data  in it "

What is int?


int is taken from the word integer that is used in mathematics and other places in our daily life.The int storage size is 4 bytes.The integer value only store in the variables that having data type int.how to declare an integer in c programming language.
                                             int a=10;   int b=5;
Here we declare two integer variables a and b that contains two values of  10 and 20.How to check the size of the int via source code in c++.

                  #include<iostream>
                  using namespace std;
                  int main()
                 {
           cout<<" Size of  int  is : "<< sizeof(int) <<endl;
               
                   return 0;
                 }

What is float?

 
float is a floating point that is used in mathematics the floating values are only stored in the floats we  can store 4 bytes in it. How to declare an float variable in c programming language.
                                              float c=5; float d=6;
Here we declare two float variables c and d that contains two values of 5 and 6.How to check the size of the float via source code in c++.

                  #include<iostream>
                  using namespace std;
                  int main()
                 {
           cout<<" Size of  float  is : "<< sizeof(float) <<endl;
               
                   return 0;
                 }

What is char?

char is taken from the word characters that are contains alphabets, mark, dollar sign, hash, at the rate and all other like as ~,@,#, $,%,^,&  and all other on your key board instead of numbers.there are 255 character including number having ASCII. Char can store only one byte in it.
                                                char c='@';    char ch='*';
here we declare two characters c and ch having values @ and *.How to check the size of the char via source code in c++.

                  #include<iostream>
                  using namespace std;
                  int main()
                 {
           cout<<" Size of  char is : "<< sizeof(char) <<endl;
               
                   return 0;
                 }

No comments:

Post a Comment

Privacy Policy for Apps

Privacy Policy Muhammad Shahbaz built the Health Physio Association app as a Free app. This SERVICE is provided by Muhammad Shahbaz at no...