Array_Class_11_CBSE_notes

107 views
77 views

Published on

Notes I prepared for my Class 11 CBSE exam. You can download it if u find it useful

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
107
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Array_Class_11_CBSE_notes

  1. 1. 1. Array: An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier. Very much useful in a case where many elements of the same data type need to be stored and processed. Element numbers in [] are called subscripts or indices. The subscripts designates the position in array’s ordering. 2. Types of arrays: a. Single Dimensional: It is the simplest form of array. The array is given a name and it elements are referenced by the indices. Index numbering starts with 0. Array definition specifies variable type, name with size. b. Two dimensional arrays: Array in which each element itself is an array. An array A [m] [n] is represented by MXN table with M rows and N columns. Simplest form of multi-dimensional arrays. 3. Advantages: we can use only one variable for storing several variables but under different indices. Very useful when we are using many variables of same data type. 4. Structure: Structure is a collection of variables under a common name. Variables can be of any data type. 5. Difference between Structure and Class: In a structure, all members are public by default, while the members of class are private by default. 6. Difference between Structure and Array: Only variables of one data type can be stored in arrays but many data types can be stored in structures. In arrays, entries are called elements while in Structures, they are called members. 7. Referencing structure elements: Members can be accessed through the dot operator. The structure variable name followed by a period (.) and the element name references to that individual structure element. 8. Typedef: C++ allows users to define new data type names by using the keyword typedef. It defines a new name for an existing data type. This can increase portability of programs and also aid in self documenting the code by allowing descriptive names for standard data types. Also defines alias structure tag name. Syntax: typedef type name; 9. Preprocessor Directives: Preprocessor commands begin with a #. No blank space should appear before the # and semicolon is not requires at the end. Things that can be done during pre-processor phase a. Inclusion of other files through #include directive. b. Definition of symbolic constants and macros through #define directive. 10. #Define: Allows us to define symbolic names and constants. If #define PI 3.14, it will translate every occurrence of PI into 3.14. It also allows you to make text substitutions before compiling a program. An advanced use of it is creation of macros (#define SQUARE(x) x*x)

×