vendredi 29 mai 2015

C - char array and char pointer

Why I can't define

char **pp={ "123", "456", "789" };

But I can defined it as a char*[] ,and send it to a function that will acsept it as a char **

char *pp[]={ "123", "456", "789" };
fun(pp);

void fun(char **pointerToPointer)
{
    //++(**pointerToPointer);//error
    printf("%s", *pointerToPointer); 
}
//output::"123"

And why I can't increment

++(**pointerToPointer);

Aucun commentaire:

Enregistrer un commentaire