I have been teaching myself c++ for a little while now and came across something I couldn't figure out. I am trying to figure out how many char*s there are in a char**. In the current program I am using *argv[], so I can access it through argc, but is there a way to find that number without a second variable in case I do not have access to something like argc in another variable? Second, can you overload the assignment operator for the string class? I want to overload = for a string* so that it can be assigned a char**. Thank you for any help you may offer.
#include <string>
#include <stdlib.h>
using namespace std;
/* operator here??
string string::operator= (char*);*/
int main(int argc,char *argv[])
{
string * test1 = new string[argc];
//replace next 2 lines with single statement using = operator
for (int a = 0; a < argc; a++)
test1[a] = argv[a];
for (int b = 0; b < argc; b++)
printf("argv[%d] : %s\nstring[%d] : %s\n",b,argv[b],b,test1[b].c_str());
}