Learn data types of c++ at TCCI, Ahmedabad

Learn data types of c++ at TCCI, Ahmedabad
Learn data types of c++ at TCCI, Ahmedabad
In programming Language user have to store data into the variable, variable is nothing but memory location where we store the data. Variable can store only one data at a time. We can also update this value by processing.


As we know data can be any type means simple number or real number, it may be character data also, when user is doing programming, may be user know the type of data, but computer (machine) can't differentiate this types, so during programming coder has to differentiate this types of data, so when compiler compile the source code, it can differentiate the data as per their types.

In programme initial part is declaration part of data. Variable declaration should be done with its data types, Data types is not useful only for differentiate data but also compiler can allocate memory as per types, Because in programming language data are categorized as per types, and they all have different  size and range allocated. As per their type memory is allocated and value which input to variable it's also as per this type.

This size may be vary machine to machine or programming language.

Let us see in detail these data types in c++ language.



Data Type

Memory (ByteS)

Minimum Value

Maximum Value

Bool

1

Logical Value T/F

Logical Value T/F

Char

1

-128

127

Unsigned Char

1

0

255

Short

2

-32768

32767

Unsigned Short

2

0

65535

int

2

-32768

32767

unsigned int

2

0

65535

Long

4

-2147483648

2147483647

unsigned long

4

0

4294967295

float

4

10-38

1038

double

8

10-308

10308

long double

10

10-4932

104932



C++ offers a predefined data type that is one byte in size, which can hold exactly one character such as �a' or �A'. To declare a variable of type char, we have


Char ch;

Suppose we want to store a character value �a', in a char data type ch, it is enclosed within a single quote.

Ch = �a';

Actually character has 4 sub category,

0 to 9 digit

A to Z

ato z

any symbol

Suppose we want to store 0to 9 digit then integer type is used,

I.e. int a=123;

Int occupies 2 bytes but if we require long memory then we can use.

If data are real number, then use float data type.

Float a=78.234;

Also float has long double, which can use for long memory requirement.

If you like this post then like the post and share this post.

To Learn More about TCCI

We teach following topics in c++ course:

1. Introduction to C++

2. Basic Syntax

3. Object Oriented Concept

          a. Inheritance

          b. Data Abstraction

          c. polymorphism

          d. Encapsulation

4. Data Types and Variables

5. Constants, Literals

6. Modifiers

7. Operators

8. Loop Controls

          a. For Loop

          b. While Loop

          c. Do-While Loop

9. Decision Making

If-Else

10. Class Structure with Object

11. Function

12. Arrays

13. String

14. Inheritance

15. Constructor-Destructor

16. Exception Handling

17. Files

Course duration: Daily/4 days/3 Days/2 Days.

Class Mode: Theory with Practical.

Lecture Timing: At student's convenience.

Source:www.articlesbase.com

Related Posts