Tag: C
Check if Any element in Array is NULL in C++
This tutorial will discuss about a unique way to check if any element in array is null in C++. To check an array has any NULL value, we will use the std::any_of() function from STL Algorithms. The std::any_of() function accepts three arguments, Advertisements Iterator pointing to the start of a sequence. Iterator pointing to the …
Check if Any Element is Negative in C++ Array
This tutorial will discuss about a unique way to check if any element is negative in C++ array. To check an array has any negative value, we will use the std::any_of() function from STL Algorithms. The std::any_of() function accepts three arguments, Advertisements Iterator pointing to the start of a sequence. Iterator pointing to the end …
Check if Array contains a specific String in C++
This tutorial will discuss about a unique way to check if array contains a specific string in C++. Suppose we have a string array, and a string value. Like this, const char* arr[] = {“This”, “is”, “a”, “sample”, “text”, “message”}; std::string strvalue = “sample”; Now, we want to check if this string array arr contains …
Check If Array Contains Duplicates in C++
In this article, we will discuss different ways to check if a C++ array contains duplicates or not. Video Tutorial to check if an Array has any Duplicate Value in C++ Table of Contents Problem Description Check if array contains duplicates using Iterative approach with two loop Check if array contains duplicates using sort() function …
Check if an Array is Palindrome in C++
This tutorial will discuss about a unique way to check if array is palindrome in C++. Video Tutorial : Check if an Array is Palindrome using STL Algorithm std::equal() Subscribe To check if an array is palindrome or not, we need to comprare the first half of array with the reversed second half of array. …
Check if an Array is Symmetric in C++
This tutorial will discuss about a unique way to check if an array is symmetric in C++. Suppose we have an array, int arr[] = {7, 6, 5, 4, 3, 4, 5, 6, 7}; Now we want to check if this array is Symmetrical or not. Advertisements To check if an array is symmetric or …
Check if an Array is a Subset of Another Array in C++
This tutorial will discuss about a unique way to check if an array is a subset of another array in C++. Suppose we have two arrays, int arr1[] = {72, 51, 12, 63, 54, 56, 78, 22}; int arr2[] = {63, 54, 56}; Now we want to check if the second array arr2 is a …
Check if an Array is a Subset of Another Array in C++Read More
Check if Array Contains Only Empty Strings in C++
This tutorial will discuss about a unique way to check if array contains only empty strings in C++. Suppose we have a string array. Like this, const char* arr[] = {“”, “”, “”, “”, “”, “”, “”}; Now, we want to check if all the strings in this array are empty or not. Advertisements For …
Check If Any Element in Array Matches Regex Pattern in C++
This tutorial will discuss about a unique way to check if any element in array matches regex pattern in C++. The std::regex_match() function from the <regex> header file, accepts a string as the first argument and a regex pattern as the second argument. It returns true if the given string matches the given regex pattern. …
Check If Any Element in Array Matches Regex Pattern in C++Read More
Check If Index Exists in an Array in C++
This tutorial will discuss about a unique way to check if index exists in an array in C++. While using an array in C++, many times we need to access an element from array based on the index position. But if we try to access an element at an index position that is invalid or …