0

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!!!

2
Contributors
2
Replies
10
Views
10 Years
Discussion Span
Last Post by Ancient Dragon
0

I think

#include <string>

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

0

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
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.