Error:
x.cpp:641:39: error: invalid conversion from ‘void*’ to ‘char**’
x.cpp:644:39: error: invalid conversion from ‘void*’ to ‘char*’
Code:
int argc;
char **argv;
char **argvv;
argvv = malloc (argc * sizeof(char *));
for(int i = 0; i < argc; i++)
{
argvv[i] = malloc(200 * sizeof(char));
}
argc and argv receive the arguments from the command line through main ().
What you wrote is valid C, but invalid C++.
Make sure you use a C compiler, and name your files
.crather than.cpp(GCC will infer language from file extensions in some cases).Or write C++, and use
std::vector(or some other container type best suited to your needs) andstd::stringto remove the memory allocation trickyness.