5.1.3. Initialization of Array, Chapter - 5, Arrays and String, HSSC-II (12th Class) Computer Science Key Point Notes

5.1.3. Initialization of Array, Chapter - 5, Arrays and String, 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 5: Arrays and String


5.1.3. Initialization of Array

  • To initialize an array, the initializing values are enclosed within the curly braces in the declaration and placed following an equal sign after the array name. Here is an example:
            int myArray[5] = {1, 2, 3, 4, 5, 6};
  • If the number of values supplied are less than the actual number of item in the list then extra spaces in the array will be filled in with zeroes.
  • If the number of values supplied is greater than the actual size of the array then the compiler will give an error message.
  • If the size of the array is not supplied, the compiler will count the number of items in the initialization list and fix that as the array size. For example:
                    int myArray[] = {5, 6, 8, 6, 9, 6};


************************************
👉👉👉 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