Home | | Computer Science 11th std | C++ Data types

Introduction to C++ - C++ Data types | 11th Computer Science : Chapter 9 : Introduction to C++

Chapter: 11th Computer Science : Chapter 9 : Introduction to C++

C++ Data types

In C++, the data types are classified as three main categories

C++ Data types

 

In C++, the data types are classified as three main categories

(1) Fundamental data types

(2) User-defined data types and

(3) Derived data types.


In this chapter, we are going to learn about only the Fundamental data types.

In order to understand the working of data types, we need to know about variables. The variables are the named memory locations to hold values of specific data types. In C++, the variables should be declared explicitly with their data types before they are actually used.

 

Syntax for declaring a variable:

<data type> <variable name>;

 

Example:

int num1;

To declare more than one variable which are of the same data type using a single statement, it can be declared by separating the variables using a comma.

 

Example:

int num1, num2, sum;

For example, to store your computer science marks; first you should declare a variable to hold your marks with a suitable data type. Choosing an appropriate data type needs more knowledge and experience. Usually, marks are represented as whole numbers. Thus, your variable for storing the computer science marks should be an integer data type.

 

Example:

int comp_science_marks;

Now, one variable named comp_science_marks is ready to store your marks.

We will learn more about variables later in this chapter.

 

Tags : Introduction to C++ , 11th Computer Science : Chapter 9 : Introduction to C++
Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
11th Computer Science : Chapter 9 : Introduction to C++ : C++ Data types | Introduction to C++


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.