List of Common Data types
Integer/Long
Float/Double
Char
String/Text
Boolean
Integer = An integer type value is a whole number representation in 32 bits, this means any variable in your program with integer type will not accept numbers with fractions like 1.1,1.2,3.8 but will only accepts numbers like 1,8,3,9,10,22.
Example Declarations:
C/C++
int variablename;
Java
int variablename;
Visual Basic
Dim variablename as Integer
Long = Long variable type is a whole number representation just like Integer but in a 64 bits and will accept values bigger than Integer type.
Example Declarations:
C/C++
long variablename;
Java
long variablename;
Visual Basic
Dim variablename as Long
Float and Double = This is real numbers representation. This will accept whole numbers and numbers with fractions as well.
Example Declarations:
C/C++
float variablename; double variablename;
Java
float variablename; double variablename;
Visual Basic
Dim variablename as Double (Basic will only accepts Double)
Char = Char data type will accepts values like letters, a single character, this will not accepts word/s or a series of characters, a sentence.
Example Declarations:
C/C++
char variablename;
Java
char variablename;
Visual Basic
Dim variablename as char
String/Text = Unlike char, this data type will accepts a series of characters, word/s, a sentence, even a paragraph.
Example Declarations:
C/C++
char variablename[5]; //array of cahracters with length 5 or
Char* variablename: //a char pointer
Java
String variablename;
Visaul Basic
Dim variablename as String
Boolean = A data type which only holds value of zero or one or a true/false.
Example Declarations:
C/C++
bool variablename;
Java
boolean variablename;
Visual Basic
Dim variablename as Boolean
Download PDF File
No comments:
Post a Comment