Farhan Muhamed has Published 147 Articles

emplace vs insert in C++ STL

Farhan Muhamed

Farhan Muhamed

Updated on 03-Jun-2025 17:49:33

1K+ Views

In C++ STL, both emplace and insert functions are used to add elements to containers such as vectors, lists, and maps. But, emplace is more efficient than insert as it avoids unnecessary copying of object and does the insertion more efficiently than insert operation. In this article, we will discuss ... Read More

Passing Arrays to Function in C++

Farhan Muhamed

Farhan Muhamed

Updated on 02-Jun-2025 19:35:02

377 Views

In this article, we will learn different ways to pass arrays to functions in C++ and how to work with them effectively. Passing Arrays to Functions Here are list of approaches to pass arrays to functions in C++ that will be discussed in this article along with examples: ... Read More

How to create a dynamic array of integers in C++ using the new keyword

Farhan Muhamed

Farhan Muhamed

Updated on 02-Jun-2025 19:34:43

10K+ Views

Dynamic arrays are a type of array that can change their size when new elements are added or removed. They are created using pointers and memory management operators like new and delete. In this article, we will learn how to create and use a dynamic array in C++. What ... Read More

How to pass an array by reference in C++

Farhan Muhamed

Farhan Muhamed

Updated on 29-May-2025 19:13:47

7K+ Views

Passing an array by reference is a method of passing arrays to functions in C++ that allows the function to access and modify the original array without creating a copy. In this article, we will learn how to pass arrays by reference, the benefits of this approach, and provide examples. ... Read More

How to use std::sort to sort an array in C++

Farhan Muhamed

Farhan Muhamed

Updated on 29-May-2025 19:13:01

8K+ Views

Sorting of an array refer to the process of arranging the elements of the array in ascending or descending order. In this article, we will learn how to use the std::sort function from the C++ STL library to sort an array. In this problem, you are given an ... Read More

4 Dimensional Array in C/C++

Farhan Muhamed

Farhan Muhamed

Updated on 29-May-2025 19:12:08

997 Views

4 Dimensional ArrayThe 4 dimensional array is an array of 3 dimensional arrays. Each 3 dimensional array is an array of 2 dimensional arrays and each 2 dimensional array is an array of 1 dimensional arrays. In this article, we will learn all about 4 dimensional arrays, how to create ... Read More

How to create a dynamic 2D array inside a class in C++

Farhan Muhamed

Farhan Muhamed

Updated on 28-May-2025 17:37:28

842 Views

A dynamic 2D array is an 2D array in which the size of array is determined during runtime and stored using pointers. In this article, we will learn how to create a dynamic 2D array inside a class in C++. First of all, let's understand the problem statement. In ... Read More

How to print dimensions of multidimensional array in C++

Farhan Muhamed

Farhan Muhamed

Updated on 28-May-2025 17:37:16

213 Views

A multidimensional array is an array with more than one dimension. It means that the array can grow in multiple directions, such as length, width, and height. In this article, we will learn how to print the dimensions of given multidimensional array in C++. First of all, let's understand the ... Read More

Why doesn\\'t C++ support functions returning arrays

Farhan Muhamed

Farhan Muhamed

Updated on 27-May-2025 18:23:19

169 Views

C++ does not support functions that return arrays directly because arrays do not have a built-in size or type information that can be returned along with the array. This design choice was made by the C++ creators to avoid memory management issues. But, we have alternative methods to achieve similar ... Read More

Raw string literal in C++

Farhan Muhamed

Farhan Muhamed

Updated on 27-May-2025 18:11:23

561 Views

Sometimes, in C++ when you try to print a string that containing special characters like escape sequences (), backslashes (\), or quotes(""), the output may not be as expected. To avoid this, C++ provides a feature called raw string literal. In this article, we will discuss what is raw string ... Read More

Previous 1 ... 6 7 8 9 10 ... 15 Next
Advertisements