Consider the following program:
#include <stdio.h>
void foo(char** string)
{
printf("%s", string[0]);
}
int main()
{
char* a = "blahblah";
foo(&a);
return 0;
}
It works fine as it is, but if I substitute
char* a = "blahblah";
with
char a[] = "blahblah";
it does not work.
I get the warning expected 'char **' but argument is of type 'char (*)[9]'
, and a segmentation fault.
I was under the impression that char[]
and char*
are the same thing, so a pointer to each of them would also be the same.
(windows with mingw, gcc 4.8.1)
Thank you