![]() |
In C++, an array of a string is used to store multiple strings in contiguous memory locations and is commonly used when working with collections of text data. In this article, we will learn how to declare a pointer to an array of strings in C++. Pointer to Array of String in C++If we are working with C-style strings, we can directly declare the pointer to array of strings as double pointer to and for Syntax to Declare Pointer to an Array of String in C++char **ptr
For std::string object use the below syntax: string* pointerToArray;
C++ Program to Declare a Pointer to an Array of StringsThe following program illustrates how to declare a pointer to an array of strings in C++ C++
Output
Array Elements: Str1 Str2 Str3 Str4 Time Complexity: O(1) |
Reffered: https://www.geeksforgeeks.org
C++ |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 12 |