G
grahamo
somefunc(char** arg)
{
*arg =strdup("hello world");
}
someotherfunc(char** arg)
{
char* tmp = strdup("goodbye world");
arg = &tmp;
}
int main(int argc, char** argv)
{
char** foo;
char** bar;
somefunc(foo);
someotherfunc(bar);
return 1;
}
On some platforms I've tested these work, on some others the don't.
Are the uses of somefunc and someotherfunc above valid?
How can I dereference arg in somefunc above when it hasn't been
initialised to anything? Or is it plain old rubbish?
thanks
Graham
{
*arg =strdup("hello world");
}
someotherfunc(char** arg)
{
char* tmp = strdup("goodbye world");
arg = &tmp;
}
int main(int argc, char** argv)
{
char** foo;
char** bar;
somefunc(foo);
someotherfunc(bar);
return 1;
}
On some platforms I've tested these work, on some others the don't.
Are the uses of somefunc and someotherfunc above valid?
How can I dereference arg in somefunc above when it hasn't been
initialised to anything? Or is it plain old rubbish?
thanks
Graham