I just can't seem to get this right.
The example in the week 2 short Arrays is as follows:
int foo[5]{1,2,3,4,5};
int bar[5]
for(j=0;j<5;j++) { bar[j]=foo[j]; }
This does not seem to work with strings in my case. I have tried two methods:
int main (int argc, string argv[2])
{
int keylen=strlen(argv[1]);
int pk=0;
string ky[keylen];
for(pk=0;p<keylen;pk++)
{
ky[pk]=tolower(argv[1][pk);
}
...
and a little longer method where I specify that the data on the right is a char.
int main (int argc, string argv[2])
{
int keylen=strlen(argv[1]);
int pk=0;
string ky[keylen];
for(pk=0;p<keylen;pk++)
{
char ori=argv[1][pk];
ky[pk]=tolower(ori);
}
...
I keep getting this error in both cases:
incompatible integer to pointer conversion assigning to 'string' (aka 'char *') from 'int' [-Werror,-Wint-conversion]
What am I doing wrong?