I got this warning: incompatible pointer types passing 'char (*)[1024]' to parameter of type 'char *'
My code looks like this:
myfunc(char* sString, size_t s_tString)
{
memset(sString, '\0', s_tString);
...
fPipe = (FILE *)popen (sString, "r");
...
}
int main()
{
...
char sString[1024];
myfunc(&sString, sizeof(sString));
...
}
After calling myfunc sString has the value I was expecting but the compiler throws that warning... After asking some coworkers I get why I'm getting that warning but we don't know why the code is still working.
I'm looking for the explanation of why this happens, the fix is pretty simple, rmove the & from the call.