Using array in programming, we allocate a fixed size for our data. This size can't be increased or decreased while execution of the program. We can't change it even if the size allocated is more or less than our requirement. This type of allocation of memory is called Static Memory Allocation. This leads to wastage or shortage of memory.
Inheritance is the process of inheriting properties of objects of one class by objects of another class. The class which inherits the properties of another class is called Derived or Child or Sub class and the class whose properties are inherited is called Base or Parent or Super class.
Biologically, Inheritance is a term which means acquiring characters of parents by their offspring. Children often seems to have traits that their parents have like similar eye color, style of speaking, walking, etc. Additionally, they have their own traits too.
Array is a collection of variables of fixed size stored in a continuous memory location. They are also known as elements. These elements are accessed by its index. The elements in an array are numbered from 0 to n-1 (n being the length of array), those numbers are called indices.
If more than one functions having same name but differing in terms of number and types of argument it takes is used in a class, it is known as function overloading. It is an example of compile time polymorphism (static/early binding). The compiler determines which function is called during compile time based on the number and types of argument sent.
In C++, private members remain hidden and can only be accessed by other member function of that class and friend function. Friend function is defined or declared using keyword 'friend' before the function prototype inside the class. It takes objects as parameter and access their private members using object name and dot(.) operator. Friend function is used when we need to operate on data of two or more objects of same or different classes. For e.g.
The main thing required in creating a pattern in C is understanding how to use nested loops properly and knowing how the characters in pattern changes.
Here are a few examples to increase your understanding of patterns.
A prime number is the number which can be exactly divided by only 1 and the number itself. For example, 5 can only be exactly divided by 1 and the number itself, so 5 is a prime number. But 8 can be divided by 1, 2, 4 and 8 so it is not a prime number but a composite number. To find and display all prime numbers between 10 and 100, nested loop is to be used. The outer loop runs from 10 to 100 and the inner loop checks whether the number is prime or not.
There are different types of series in mathematics which can be solved easily in C programming. This section deals with finding sum of following types of series in C program.