pass char array as argument

Viewed 70803

Can anyone explain to me what I don't understand here please?

I am trying to pass the argument as a "string" (i know there are no strings in c) so that I can use that string later with other functions like it's a file name that has to be passed for example. But I don't know why it won't accept it or what type should it be

#include <stdio.h>

int main ( int argc, char *argv[] )
{
    char *array= argv[0];
    foo(*array);
}

void foo( char *array) 
// notice the return type - it's a pointer
{
    printf(array);
}

thanks alot!

3 Answers
Related