Reputation: 23
Am I declaring this correctly?
string regular = "TEST";
long[] cipher = new long[regular.length()];
Getting this compilation error: expected unqualified-id before '[' token
Upvotes: 1
Views: 2129
Reputation: 170123
a new
expression returns a pointer, so your cipher
must be one:
long *cipher = new long[regular.length()];
But using raw arrays is error prone. Consider substituting std::vector
instead:
std::vector<long> cipher(regular.length());
Upvotes: 8