C++ Pointers and Arrays

In this section, you will learn how pointers and arrays are related to each other. Before that, you should have knowledge on the following topics in C. C++ Arrays C++ Pointers Pointers and arrays are strongly related to each other. In general, the name of the array is a pointer itself, it points to the … Read more

C++ Pointers

Pointer is an important part of the programming as it deals with the memory address of the variables. There are various tasks that can be achieved easily with the use of pointers in C++ such as dynamic memory allocation that needs pointers for its operation. It also minimizes the execution time and saves memory space. … Read more

C++ Return Array from Functions

C++ allows us to return the arrays from a function. However the actual array values cannot be returned, so we return the array from the function with the help of pointers. Pointers are the variables that hold an address. With the help of pointers, the address of the first element is returned from a function. … Read more

C++ Multidimensional Arrays

C++ allows Multi-Dimensional Arrays. This could be of 2D or 3D (two-dimensional or three-dimensional) Array. These arrays are stored in the form of a table (with rows and columns) which is also known as a matrix. In C++, multidimensional array is also known as rectangular arrays. Syntax of multi-dimensional array: The data-type must be a … Read more

Passing Array to a Function in C++

In C++, passing an array to a function in the one-Dimensional array is done through an actual parameter and array variables with subscript are passed as formal arguments. While passing the array only the name of the array is passed to the function. Same method is applied for the multi-dimensional array. The syntax for passing … Read more

C++ Arrays

An array is a group or a fixed-size sequential collection of data having the same data-type stored in a contiguous memory location. It is a simple data structure format where the primitive type of data such as int, char, double, float, etc are stored and accessed randomly through their index number such as array[0], array[1], etc. … Read more

C++ Recursion

Recursion refers to the process when a function calls itself inside that function directly or indirectly or in a cycle. And such functions are called recursive functions. However, the crucial part is the termination condition, if not handled properly then it might go into an infinite loop. We can use the if…else statement to stop … Read more

C++ Storage Classes

What is Storage Class in C? Storage class is used to define the scope and lifetime of a variable. It tells the compiler where to allocate memory for a variable. Every variable in C++ has a type and the storage class. The type defines its data types such as int, float, etc. While storage defines … Read more

Call by Value and Call by Reference in C++

There are two ways in which the argument can be passed through a function in C++ Programming. Call by Value Call by Reference Let’s go through call by value and call by reference in C++ language one by one. C++ call by value The method of call by value copies the actual argument to the … Read more

C++ Functions

A function refers to a block of code (or a group of statements) that performs a specific task. A function takes some inputs, does some computation based on that input and returns the output. The function can be called many times by passing different values each time. For example, let us say that you need … Read more