Object Oriented Programming: Chapter 1: Principles of Object Oriented Programming

Variables

Definition, Syntax, Declaration and Initialization | C++ Programming

Questions: 1. Illustrate variables declaration and initialization procedure. 2. What do you mean by variable declaration? Why it is necessary?

Variables

• In C++, a variable is a named storage location in memory that holds a value which can change during the execution of a program.

• Definition : Variable is an entity in C++ program that stores some value. This value can be numeric, character, floating point on so on.

• Syntax :

Data_Type Variable_name;

• Declaration and Initialization :

int a;//declaration

int b://declaration

a=10;//initialization

cin>>b;//initialization

• The purpose of variable to give name to the storage and store value for that storage. C++ allows dynamic initialization. For example ‒ int i=10; is allowed at any where in the program.


Review Questions

1. Illustrate variables declaration and initialization procedure.

2. What do you mean by variable declaration? Why it is necessary?

 

Object Oriented Programming: Chapter 1: Principles of Object Oriented Programming : Tag: Oops, Computer Programming : Definition, Syntax, Declaration and Initialization | C++ Programming - Variables


Object Oriented Programming: Chapter 1: Principles of Object Oriented Programming



Under Subject


Object Oriented Programming (OOPs)

CS25C07 2nd Semester CSE, CSE(CY) Depts | 2025 Regulation | 2nd Semester 2025 Regulation



Related Subjects


English Essentials II

EN25C02 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation



Linear Algebra

MA25C02 2nd Semester | 2025 Regulation


Applied Physics (CSIE) II

PH25C03 2nd Semester AIDS, CSE, IT, CSE(CY) Dept | 2025 Regulation | 2nd Semester 2025 Regulation


Digital Principles and Computer Organization

CS25C06 2nd Semester AIDS, CSE, IT, CSE(CY) Dept | 2025 Regulation | 2nd Semester 2025 Regulation


Basic Electrical and Electronics Engineering

EE25C01 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation


Object Oriented Programming (OOPs)

CS25C07 2nd Semester CSE, CSE(CY) Depts | 2025 Regulation | 2nd Semester 2025 Regulation


Re-Engineering for Innovation

ME25C05 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation


Object Oriented Programming (OOPs) - Laboratory

CS25C07 2nd Semester CSE, CSE(CY) Depts | 2025 Regulation | 2nd Semester 2025 Regulation