No of visitors who read this post: 709
Type: Question
Author: Chloe Lee
No votes yet

Hi Programmers,

What are the different data types in general programming and what are their function? Explain each data types to me.

Thanks.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

# Comment Id: 53894

 Programming languages are human-engineered languages developed to convey instructions to machines; they are based on rules of syntax and semantics. Thousands different programming languages have been developed, used, and discarded. Following are the different types of programming languages and their details:

1. Logic Programming:

Logical Programming languages work on simple facts and relations from which a logical solution and conclusion can be drawn.
Eg: Oz, Gödel.

2. Functional Programming:

Functional programming languages are more closely related to the mathematical concept of `function'.
Eg: Haskell, pragma.

3. Imperative Programming:

Also known as procedural programming, imperative programming is associated with the concept of analysis and step by step solution. Imperative programming is distinguished from functional programming in that the former is strongly tied to the concept of variables and memory locations.
Eg: C,Fortran.

4. Concurrent Programming:

Concurrent programming is characterized by programming with more than one process. The main advantage of concurrent programming is that operations can run parallel in it, thus they are much faster than sequential operations. The behavior of concurrency can be implemented in C++, Java.

5. Object-Oriented Programming:

Object oriented programming is the method of implementing programs which are organized as cooperative collections of objects, and each of which represents an instance of some class, and whose classes are all members of a hierarchy of classes united via inheritance relationships.
Eg:C++, Java.

# Comment Id: 55489

Hello,

 
Data types are different with each programming language, only in the terms used. But in general, here are the basic data types that are used in general programming languages.
 
INTEGER
 
Natural/whole number without a fractional or decimal part. it may be a negative whole number.
Example: -100, 0, 55
 
Most programming languages today have the short integer and the long integer data types. Both are integers, only having a smaller data width and larger data width, relatively. Meaning, short integer has a smaller range of whole numbers from negative to positive, while long integer has a wider range.
 
The function of integer is to hold data like quantity of items, number of days,hours, seconds, or any data that doesn't contain fractional component.
 
FLOATING-POINT/REAL NUMBER
 
Number that can contain a fractional or decimal part. also has its negative and positive values.
Example: -100.46333, 0.5, 55.75
 
There are two kinds of floating-point data type in almost all programming languages. The single precision and the double precision. They both store an approximation of a real number. The double precision floating-point provides the largest and smallest possible magnitudes for a number, while single precision floating-point can contain values that do not require that magnitudes of data.
 
The basic function of floating-point is to hold data with precise values, such as temperature, or wide range precise values with its decimal part as well, such as mass. Floating-point can also be used for monetary units, however, language such as Visual Basic has its own data type for currency.
 
STRING
 
data type that holds alpha-numeric character set or sequence (may contain special characters and symbols), used typically as words and text in programming.
Example: "123", "abc", "ABC123", "Hello World!"
 
String or text data type can be a fixed size or variable length. For instance, in C language, fixed size string is declared as char variable name[size]; (e.g. char name[50];). While in Visual Basic, char is a string data type that can only store a single character. Visual Basic's fix size can be declared as Dim variable name As String * size (e.g. Dim name As String * 50).
 
String function is to hold data such as name, address, password or any other literary texts that don't involve calculations.
 
BOOLEAN
 
Data type having only two values or two states that represent the truth values of conditional statements in programming.
Example: True, False.
 
Boolean can also be denoted as on/off, yes/no.
 
The function of boolean is for flagging that defines or track whether a condition is true or false.
 
Those are the general and basic data types used in programming languages.
 
Data types such as byte (smaller then short integer) are just derivation of the existing data types. Other data types are user-defined and depend on the programming language.
 

Life with a destiny is a train on rail; an unfortunate journey without choices.