Hello,

I have a quick question: How do I declare array of strings with a static size entered by user during run time in C++?

In C# i'd do

// Get user unput (int, # of strings);

string[] stringArray = new string[numOfStrings];

//tell user to start imputing the string

But I'm lost with C++. Thank you for your help!!!

I think

#include <string>

was the key to my question. Sorry, newb here.

you have to declar the array as a pointer.

// Get user unput (int, # of strings);

string* stringArray = new string[numOfStrings];

//tell user to start imputing the string
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.