3.2.1 C++ Constants and Variables, Chapter3 - Object Oriented Programming in C++, HSSC-II (12th Class) Computer Science Key Point Notes

3.2.1 C++ Constants and Variables, Chapter3 - Object Oriented Programming in C++, HSSC-II (12th Class) Computer Science Key Point Notes

12th Class (HSSC-II) Computer SLO Based Key Point Notes

(National Book Foundation - As Federal Textbook Board, Islamabad 
Based on National Curriculum Pakistan 2023-2024 and Onward prescribed by Federal Board of Intermediate and Secondary Education, Islamabad, and All Pakistan Boards) 

{Contact WhatsApp 03339719149 for Class-XII Computer Science Complete SLO-Based Key Points notes in pdf format as well as in PowerPoint Presentation for preparing/delivering the Lectures}

************************************

👉👉👉 Computer Science 12th Class Notes (Main Page)

************************************

Unit 3: Object-Oriented Programming in C++


3.2.1 C++ Constants and Variables


Constant:

  • A constant is a quantity that cannot be changed during program execution.
  • It can be a number, a character, or a character string. A character string is a sequence of any number of characters.
  • Examples: 42, 7.25, ‘s’, “computer” etc.

Variable:

  • A quantity whose value may change during the execution of the program is called a variable.
  • A variable is a space in a computer’s memory, used to store data and given a name for easy reference. OR
  • In C language, a variable is a memory location that is identified by a name to store a data of particular type.

Rules for Naming a Variable:

Following are the rules for naming variables in C:
  1. A variable name may consist of digits, upper case, and lower case alphabets, and underscore symbols i.e. “_”
  2. The first character of a variable name must be an alphabet character or underscore.
  3. Keywords/Reserved words of C++ cannot be used as variable names.
  4. Special symbols such as $, @, %, #, etc. are not allowed.
  5. Two variables cannot be of the same name.
  6. C is a case-sensitive language. Variable names with the same spelling but different cases are treated as different variable names.
  7.  A meaningful name should be given to the variable which can help to understand the purpose of the variable.
  8. Blank space or comma is not allowed.


👇👇👇👇👇👇👇👇👇👇👇👇

************************************
👉👉👉 Computer Science 12th Class Notes (Main Page)

************************************


************************************
Shortcut Links For:

1.  5th Class All Subjects Notes

2.  8th Class All Subjects Notes

3.  Easy English Grammar Notes



1. Website for School and College Level Physics   
2. Website for School and College Level Mathematics  
3. Website for Single National Curriculum Pakistan - All Subjects Notes 

© 2023 & onwards Academic Skills and Knowledge (ASK  

Note:  Write me in the comments box below for any query and also Share this information with your class-fellows and friends.

Post a Comment

0 Comments

cwebp -q 80 image.png -o image.webp