DEV Community

Vasudevan Tamilarasan
Vasudevan Tamilarasan

Posted on

Programming Discussion

Programming Discussion:

Whenever we are trying to code a program, the things:
1. Understand the problem first.
2. Try to code this in pen
3. Draw a flow-chart for the execution flow, if you sure about the flow chart, the problem is solved by 50%.

Flow chart:
Try to clearly understand the situation with clear conditioning and care about that results.
The clear understand of the scenarios will leads to the successful result.

What is Datatype?

1. Datatype is a logical idea of having an certain effects that need to be done on that.
2. Computer can understand what type of data is that using this datatype.
Enter fullscreen mode Exit fullscreen mode

What is Variables?

Variables are act like a container that are used to store values within it. But values may or may not be the same format.
Enter fullscreen mode Exit fullscreen mode

If same format is same, that's usual. But what if the values are in different format, how we store the values, how we stored these types of values, how we can define what types of operations are to be performed on this values.

For all of these questions, data types can help in some ways.

Each type of data has its own nature: e.g, numbers can be performed arithmetically, characters can be concatenated and not arithmetic, 0's and 1's are can be stored to show status of the work. 

Datatype gives the regulation of a variable to act like specific container for a specific value:(variables for storing values)

Datatype defines to:

    1) It sets the exact memory space for the respective type of data.
    2) It defines what type of operation that can be perfomed on the values.
Enter fullscreen mode Exit fullscreen mode

Datatypes are majorly categorized into two types:

  1. Primitive Data types - It defines a fixed length for the data.
  2. Non Primitive Data types - It defines the memory dynamically and it cannot be static, It may the collection of element or etc...

Languages that supports Primitive & Non-Primitive Datatype:

  1. C/C++ - Primitive -> int, short, long, float, double, char, bool
    Non-Primitive -> struct, arrays, unions.

  2. Java - Primitive -> byte, int, short, long, float, double, char, boolean
    Non-Primitive -> user-defined classes, pre-defined classes, arrays, strings.

  3. C# - Primitive -> byte, int, short, long, float, double, char, bool
    Non-Primitive -> user-defined classes, pre-defined classes, arrays, strings.

Languages that are not supports Primitive & Non-Primitive Datatype:

Python, Ruby - Everything are treated like an objects.

Top comments (0)